You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am attempting to programmatically reset the component path state. I found the dispatchPathAction function on the instance of the component, and I can see there is a convenient action to reset defined in the enum pathActions.
I am having a bug when importing pathActions into my app to use the dispatch function. Due to the way enums work the string "RESET" does not match the enum RESET = "RESET" so I am forced to import the original enum from the lib directory like so: import {pathActions} from "react-lasso-select/lib/pathReducer";
This import fails when running the app. From a little research this is an issue with enums (see here), that they cannot be imported from *.d.ts files.
This could be solved by simply changing the enum into a union type similar to this:
Hello,
I do not recommend accessing the internal methods of the component in this case. The best way to reset a component is to set the "value" param to an empty array.
Describe the bug
I am attempting to programmatically reset the component path state. I found the dispatchPathAction function on the instance of the component, and I can see there is a convenient action to reset defined in the enum pathActions.
I am having a bug when importing pathActions into my app to use the dispatch function. Due to the way enums work the string
"RESET"
does not match the enumRESET = "RESET"
so I am forced to import the original enum from the lib directory like so:import {pathActions} from "react-lasso-select/lib/pathReducer";
This import fails when running the app. From a little research this is an issue with enums (see here), that they cannot be imported from *.d.ts files.
This could be solved by simply changing the enum into a union type similar to this:
This would be exportable, and would also have the benefit of allowing dispatch to work with string literals e.g.
dispatchPathAction({type: "RESET"})
.To Reproduce
Steps to reproduce the behavior:
import {pathActions} from "react-lasso-select/lib/pathReducer";
)lassoRef.current.dispatchPathAction({type: pathActions.RESET})
)Expected behavior
Type/enum should be imported successfully, and code should run
Screenshots
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: