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

"Components are not mounted" error if TransformComponent render is delayed/conditional #516

Open
mhryshkin opened this issue Nov 18, 2024 · 1 comment · May be fixed by #520
Open

"Components are not mounted" error if TransformComponent render is delayed/conditional #516

mhryshkin opened this issue Nov 18, 2024 · 1 comment · May be fixed by #520

Comments

@mhryshkin
Copy link

Describe the bug

I have a tree of components. At the root, I use the TransformWrapper. Further down in the tree, I use the TransformComponent, but its usage is conditional or delayed, depending on the context. In my use case, I see this error:

image

To Reproduce
Steps to reproduce the behavior:
Just see in this example that render is a bit delayed:

https://codesandbox.io/p/sandbox/zoom-pan-pinch-forked-m36y5z

Expected behavior
An error should not be thrown. The parent component should not throw an error when the rendering of the child component is delayed.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@mhryshkin mhryshkin changed the title "Components are not mounted" if TransformComponent rendered delayed/conditional "Components are not mounted" error if TransformComponent rendered delayed/conditional Nov 18, 2024
@mhryshkin mhryshkin changed the title "Components are not mounted" error if TransformComponent rendered delayed/conditional "Components are not mounted" error if TransformComponent render is delayed/conditional Nov 18, 2024
@mhryshkin
Copy link
Author

One of solution i see is to add defaulting instead of throwing an error here:

if (!wrapperComponent || !contentComponent) {

for example:

if (!wrapperComponent || !contentComponent) { return { minPositionX: 0, maxPositionX: 0, minPositionY: 0, maxPositionY: 0, } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant