Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Context for state instead of mutating a prop #148

Open
bn-l opened this issue Nov 28, 2024 · 1 comment
Open

Suggestion: Context for state instead of mutating a prop #148

bn-l opened this issue Nov 28, 2024 · 1 comment

Comments

@bn-l
Copy link
Contributor

bn-l commented Nov 28, 2024

At the moment because the svelte component that calls this library "owns" the TableHandler instance, and it's supplied as a prop to the various table components, when updating sort or filter etc., the props are mutated in the children and there's a warning (in dev) that you "shouldn't mutate what you don't own" (link to docs).

Could the state of sort, filter etc be in the context on the top level datatable component using the getContext and setContext api? I really like way it's done in this reddit post: https://www.reddit.com/r/sveltejs/comments/1gzyv2h/comment/lz08wnm/.

@vincjo
Copy link
Owner

vincjo commented Dec 5, 2024

Thanks for the link, interesting.
I need to create a repro then dig into this issue

#128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants