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

Leches shares useControls; can't have multiple, distinct instances #98

Open
andretchen0 opened this issue Feb 23, 2024 · 0 comments
Open

Comments

@andretchen0
Copy link

Bug description

All controls created using useControls are added to all instances of <TresLeches /> even if they're in separate files.

Expected behavior

Allow multiple, separate instances of Leches. Don't share state across multiple, separate files.

Reproduction

StackBlitz

Solution?

Maybe create and return a unique controls instance from useControls that closes over the current controls state.

const controls = useControls({
  wireframe: false,
})

controls.useControls( /* ... add more controls to this instance */ )

Then use like

<TresLeches :controls="controls" />

Screenshot

Screenshot 2024-02-23 at 19 56 28

Context

We use Leches for Cientos' docs and often have multiple separate examples of functionality in a given docs page. But we can't have multiple Leches menus on a given page without running into this bug.

@andretchen0 andretchen0 changed the title Leches shares useControls, can't have multiple instances Leches shares useControls, can't have multiple, distinct instances Feb 23, 2024
@andretchen0 andretchen0 changed the title Leches shares useControls, can't have multiple, distinct instances Leches shares useControls; can't have multiple, distinct instances Feb 23, 2024
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

1 participant