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

unified-selection: Supply APIs to provide and use React context for accessing selection storage #829

Closed
grigasp opened this issue Jan 8, 2025 · 1 comment · Fixed by #841
Assignees
Labels
enhancement New feature or request presentation

Comments

@grigasp
Copy link
Member

grigasp commented Jan 8, 2025

  1. Add an optional peer dependency of react to @itwin/unified-selection.
  2. Provide React context provider and hook to provide/use selection storage.

For consumers this means:

  • Applications that create selection storage can provide it to underlying components using the context provider. They'd have a direct dependency on the @itwin/unified-selection package.
  • Components that need to access the storage, without having it in props, can use the useContext hook. They'd have a peer dependency on the @itwin/unified-selection package.
  • Components that don't use the context, but use selection storage in some way, can continue to have direct dependency on the @itwin/unified-selection package, like they do today.

Need to ensure documentation is very clear about how to set up dependencies on this package.

@saskliutas
Copy link
Member

Should we consider introducing @itwin/unified-selection-react package that would have APIs for storing and getting selection storage through React context? Libraries that want to use unified selection storage through context would have peer dependency on it and App would add that context to the components tree.

It probably will be a package with single file but that way we could keep all unified selection stuff decoupled from React (similar to hierarchies and hierarchies-react).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request presentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants