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

PanelStack2's animation when opening a new panel happens in the wrong direction #6723

Open
stropitek opened this issue Feb 23, 2024 · 0 comments

Comments

@stropitek
Copy link

Environment

  • Package version(s): @blueprintjs/core ^5.9.1
  • Operating System: Mac OS X / stackblitz
  • Browser name and version: Microsoft Edge Version 121.0.2277.128

Code Sandbox Stackblitz

(The code sandbox cannot be forked right now, it shows a warning about insufficient credits)

https://stackblitz.com/edit/vitejs-vite-sqvhmd?file=src%2FPanelStack.tsx

Steps to reproduce

Only reproducible if NOT using strict mode and in development OR with a production build.

  1. Click open: panel opens from the right ✅
  2. Click close: panel closes from the left ✅
  3. Click open: panel opens from the left 🔴

Actual behavior

The first time the panel opens from the right as it should. All subsequent times it opens from the left.

I believe this is because when the current stack of the component changes, the direction state is "pop" when it should be "push", until the useEffect sets it to "push" but it is too late to affect the transition component.

Expected behavior

The panel should always open from the right.

Possible solution

I already made a POC that seems to solve the issue. I make sure the direction is not a state but a value computed immediately in the render function based on the latest and the previous stack's length.

If this is confirmed to be a bug I'm happy to submit a PR.

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

2 participants