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

Need a plan for switching from SelectionManager in @itwin/presentation-frontend to @itwin/unified-selection #823

Closed
grigasp opened this issue Dec 19, 2024 · 2 comments

Comments

@grigasp
Copy link
Member

grigasp commented Dec 19, 2024

The @itwin/unified-selection package replaces SelectionManager class and its related APIs. We need to come up with a strategy how the switch is going to happen.

Before deprecating the SelectionManager, we need to provide replacements for all existing use cases. Probably the trickiest one is property renderers / editors accessing current selection through UnifiedSelectionContext. The context can be provided by the property widget, but it needs to be defined in a package that's a common peer dependency of both - the widget and renderers / editors. At the moment they don't have such a peer dependency that knows about react and unified selection.

@grigasp
Copy link
Member Author

grigasp commented Jan 6, 2025

After looking into this, I think the only way to provide a replacement for UnifiedSelectionContext is to:

  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.

@iTwin/itwinjs-core-presentation, please review the above plan.

@grigasp grigasp closed this as completed Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant