Closed grigasp closed 1 month ago
What AppUI version were you using? I think this might be resolved with 4.16.0
What AppUI version were you using? I think this might be resolved with 4.16.0
It's not. I was able to set up a minimal example of the problem: https://codesandbox.io/s/blue-bush-qls2r2?file=/src/App.tsx. There you can see that Component2
doesn't get the counter
value after it's updated by Component1
.
Describe the bug
There's a race condition in
useActiveViewport
:IModelApp.viewManager.selectedView
to state. Let's say at that moment the viewport isundefined
.useEffect
is called by React, where the hook subscribes to selected viewport changes.It's possible, that the selected viewport is set in view manager between the steps 1 and 2. That causes the change event to be triggered, but the hook is not subscribed to it yet. In that case the
activeViewport
in state isn't updated.To Reproduce
No response
Expected Behavior
I expect the hook to return selected viewport
Screenshots
No response
Desktop (please complete the applicable information)
No response
Additional context
No response