-
Notifications
You must be signed in to change notification settings - Fork 1
fix: immer proxy revocation error in swap/send execution hooks #132
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughTwo hook files updated to import Immer's Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
premiumjibles
left a comment
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.
Looks good
Problem
Users were experiencing a runtime error:
[Immer] minified error nr: 3("Cannot use a proxy that has been revoked").Root Cause
In the error handling paths of
useSwapExecutionanduseSendExecution, the code captured the Immer draft state using a shallow spread ({ ...draft }). ThecompletedStepsSet remained as an Immer proxy, which gets revoked afterproduce()finishes. Accessing this revoked proxy inswapStateToPersistedState()/sendStateToPersistedState()caused the error.Solution
Use Immer's
current()function to safely extract a deep, non-proxy snapshot of the draft state before using it outside the producer callback.Changes
useSwapExecution.ts: Importcurrentfrom Immer and use it to snapshot error stateuseSendExecution.ts: Importcurrentfrom Immer and use it to snapshot error stateSentry Issue
https://shapeshift-dao.sentry.io/share/issue/33fa363746374aa6bf60e5141b2c3e12/
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.