-
Notifications
You must be signed in to change notification settings - Fork 353
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
[LIVE-12968][LLM] QueuedDrawer: if onClose changes, drawer shouldn't auto close #7068
[LIVE-12968][LLM] QueuedDrawer: if onClose changes, drawer shouldn't auto close #7068
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 5 Ignored Deployments
|
d49b971
to
17ad40e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I tested the app and it works well! Thanks!
apps/ledger-live-mobile/src/newArch/components/QueuedDrawer/TestScreens.tsx
Outdated
Show resolved
Hide resolved
onCloseRef.current && onCloseRef.current(); // hack to avoid triggering the useEffect below if the parent changes the onClose prop | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problem with the hack here, just pointing out that they recently talked about useEvent
for this kind of scenario
https://github.com/reactjs/rfcs/blob/useevent/text/0000-useevent.md
facebook/react#14099
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaah interesting !
17ad40e
to
852b109
Compare
…ng-immediately-develop fix(llm/QueuedDrawer): QueuedDrawer shouldn't auto close (cherrypick of #7068 for develop)
✅ Checklist
npx changeset
was attached.📝 Description
The property
onClose
was indirectly a dependency of theuseEffect
that triggers auto closing in some cleanup logic of theQueuedDrawer
component.The solution is to keep
onClose
in a ref in the component so that it can still be used in thatuseEffect
without triggering the useEffect when its value changes.before.mp4
after.mp4
❓ Context
🧐 Checklist for the PR Reviewers