Closed gquittet closed 4 weeks ago
Describe the bug A clear and concise description of what the bug is.
With the v.6.4.x and below we can directly load the tree like this:
const config = CoreConfig; const reducer = TreeStore(config) const state = reducer({ tree: initTree })
CoreConfig is imported from "@react-awesome-query-builder/core"
CoreConfig
initTree is just an empty tree build like this:
initTree
Utils.loadTree({ id: Utils.uuid(), type: "group", children1: [] })
Now starting with v6.5.x, we have to define an empty action just to access the config because getLastConfig is undefined.
getLastConfig
const config = CoreConfig; const reducer = TreeStore(config) // The type INIT_TREE can be whatever you want const emptyAction = { type: "INIT_TREE", config } const state = reducer({ tree: initTree }, emptyAction)
Without this modification, I get this error:
ERROR TypeError: action is undefined tree_default tree.js:886
And the I can't init the state of my tree.
To Reproduce
Install the v6.5.x and try the example above.
Expected behavior
It should load the state without this empty action.
If it is expected, we have to update the documentation.
Thanks for the report. It's a bug, will fix in next version
Describe the bug A clear and concise description of what the bug is.
With the v.6.4.x and below we can directly load the tree like this:
CoreConfig
is imported from "@react-awesome-query-builder/core"initTree
is just an empty tree build like this:Now starting with v6.5.x, we have to define an empty action just to access the config because
getLastConfig
is undefined.Without this modification, I get this error:
And the I can't init the state of my tree.
To Reproduce
Install the v6.5.x and try the example above.
Expected behavior
It should load the state without this empty action.
If it is expected, we have to update the documentation.