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

setting control values should ignore unknown keys rather than throwing #526

Open
StephenHaney opened this issue Dec 23, 2024 · 1 comment

Comments

@StephenHaney
Copy link

StephenHaney commented Dec 23, 2024

const [params, setParams] = useControls(() => {

If you pass an object to setParams that includes a key that doesn't match to an existing parameter, it throws an error and Leva stops working.

It's a common to have defaults objects for your components which may include more keys than you actually want exposed with Leva controls. For instance, we often have a seed prop, but most of our Leva examples don't need to expose a control for seed.

It'd be better DX if you can pass extra keys to setParams that are ignored (or could be console.warned). Otherwise we need to create another type and object specific to Leva.

image

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
@StephenHaney and others