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

React package doesn't support changes to props #226

Open
LordZardeck opened this issue Apr 19, 2024 · 2 comments
Open

React package doesn't support changes to props #226

LordZardeck opened this issue Apr 19, 2024 · 2 comments
Assignees
Labels
improvement Something could be changed question Further information is requested

Comments

@LordZardeck
Copy link

What is the problem?

When using the react package, if you have state changes to the props being passed to SelectionArea, those changes are not recognized. For example, if you want to use a ref on the container prop, if that container changes, Viselect doesn't recognize these changes.

What is the current behavior?

Changing a prop to the SelectionArea results in those changes not being recognized.

Please provide the steps to reproduce and create a CodeSandbox.

CodeSandbox Link

What is the expected behavior?

Whenever you change a prop, @viselect/react should be updating to use those new props

Your environment:

Toolset (e.g. webpack, vite, vue-cli...): 
Version (@viselect/<insert package>):
Browser:  
OS:  
@LordZardeck LordZardeck added the unconfirmed Problem is not confirmed yet label Apr 19, 2024
@LordZardeck
Copy link
Author

From my best guess, it's because of the empty dependency array in SelectionArea

@simonwep
Copy link
Owner

That was on purpose since the core module doesn't support dynamic option updates. The preact/react component would have to destroy the instance and re-create it. In your case adding a key should do the job... Or what would you expect to happen? And what do you mean with a "ref on the container prop" exactly? (sorry, it's been a while with react for me)

@simonwep simonwep added question Further information is requested improvement Something could be changed and removed unconfirmed Problem is not confirmed yet labels Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Something could be changed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants