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
Is your feature request related to a problem? Please describe.
React-Sortablejs mutates the objects you pass in to maintain whether items are selected for example for multi-drag. Or filtered to exclude from dragging etc.
This means you have to transform the data on the way back out before pushing to DB. Not the end of the world but a better practice might be to use a Symbol for those props. This way they would be discarded when stringifying.
I use this technique with loggers as you wouldn't want your output to contain meta information that tags along throughout it's life/state before being realized to file console blah blah.
Describe the solution you'd like
Change the type "ItemInterface" to the following shape:
exportconstMETA=Symbol.for('META');exportinterfaceItemInterface{[META]?: {selected?: boolean;chosen?: boolean;filtered?: boolean;[key: string]: any;// just in case user wants to add props here.};id: string|number;}
Describe alternatives you've considered
Helper function to prune the data or something. Not nearly as elegant obviously.
Additional context
If you're up for this I'd be happy to do it and make a PR. I can't imagine it would take me too long to add this feature. Then maybe add an example or two.
I'd add also that this would allow the user to also be able to add tag along data/props as well which can be handy.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
React-Sortablejs mutates the objects you pass in to maintain whether items are selected for example for multi-drag. Or filtered to exclude from dragging etc.
This means you have to transform the data on the way back out before pushing to DB. Not the end of the world but a better practice might be to use a Symbol for those props. This way they would be discarded when stringifying.
I use this technique with loggers as you wouldn't want your output to contain meta information that tags along throughout it's life/state before being realized to file console blah blah.
Describe the solution you'd like
Change the type "ItemInterface" to the following shape:
Describe alternatives you've considered
Helper function to prune the data or something. Not nearly as elegant obviously.
Additional context
If you're up for this I'd be happy to do it and make a PR. I can't imagine it would take me too long to add this feature. Then maybe add an example or two.
I'd add also that this would allow the user to also be able to add tag along data/props as well which can be handy.
The text was updated successfully, but these errors were encountered: