maoberlehner/vuex-map-fields

createHelper concatenation goes haywire

geoidesic opened this issue · 2 comments

If I call the same createHelpers multiple times (for different components) I get weird concatenation repetition issues with the getters.

E.g.

getterType: "submissions/submissions/submissions/submissions/submissions/getField"
mutationType: "submissions/submissions/submissions/submissions/submissions/updateOptionField"
pathField: "formDataPath"

I think this must be to do with normalizeNamespace where it does this:

if (typeof options === "object") {
      options.getterType = ""
        .concat(namespace)
        .concat(options.getterType || "getField");
      options.mutationType = ""
        .concat(namespace)
        .concat(options.mutationType || "updateField");
      signature = "options";
    }

Any idea what exactly is causing this issue or how to prevent it?

Can you create a minimal reproduction demo on something like CodeSandbox? Thanks!

I think I've fixed this now. It's actually to do with the new work I've done on the normalizeNamespace function.
I'd like to leave this open till I submit the PR.