-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
PanelStack2 'Render active panel only' not working #4918
Comments
At the time of writing, the core version in the docs site was 3.49.0 (note this version is important to include in your bug report, instead of simply "whatever is in the online demo", since the latter changes over time). This seems to be a regression in PanelStack2; the counter state should be retained as you navigate through panels when |
I've traced the problem to this code in PanelView2 which isolates the panel component's lifecycle from that of our PanelStack2 component: blueprint/packages/core/src/components/panel-stack2/panelView2.tsx Lines 80 to 88 in beb33c2
This was added to fix bugs in controlled mode where we violated some React rules around inconsistent number of hooks called within PanelStack2. But now it seems like the memoization isn't working very well and we create a new wrapper component too often, which causes the wrapped panel to unmount and re-mount excessively. I suppose we shouldn't be using |
Apologies ref the version number, I now understand the importance and have updated the bug report. Thanks for the follow up. |
Environment
Code Sandbox
The issue happens on demo:
https://blueprintjs.com/docs/#core/components/panel-stack2
Steps to reproduce
Actual behavior
Counter value resets to 0 on return to panel 1
Expected behavior
Counter value should remain unchanged
Note I could be wrong about how this component is supposed to work, but my understanding was that by keeping all panels mounted the state of each panel should be maintained.
Possible solution
The text was updated successfully, but these errors were encountered: