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

useMapProviderContext hook unusable in custom components #1480

Open
jumpinjackie opened this issue Jul 31, 2023 · 1 comment
Open

useMapProviderContext hook unusable in custom components #1480

jumpinjackie opened this issue Jul 31, 2023 · 1 comment
Assignees
Milestone

Comments

@jumpinjackie
Copy link
Owner

jumpinjackie commented Jul 31, 2023

The useMapProviderContext hook in its current form is mostly un-usable because the context provider component for this hook is not mounted at a high-enough level where custom components will be a descendant component. These custom components will either be siblings with the context provider or their parent components are siblings, so the hook when called from a custom component will be a (default, un-initialized) viewer instance.

To fix this, we need to mount this context provider component at a higher level, preferably as a direct child of the root <App> component (or <AppInner>). However, relocating mount point is probably not trivial as the context provider is tightly coupled to init-ing the OpenLayers against a physical DOM element.

An alternative solution could be to leverage React portals so that we don't require context provider and context consumer with direct physical DOM parentage of their respective components.

@jumpinjackie jumpinjackie added this to the 0.15 milestone Jul 31, 2023
@jumpinjackie jumpinjackie self-assigned this Jul 31, 2023
@jumpinjackie
Copy link
Owner Author

If react portals is a feasible and workable solution, then we can re-target the milestone to 0.14

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