Skip to content

Conversation

@rortan134
Copy link
Contributor

Previously, callbacks passed to ‎useActionCallbacks could become stale if their references changed between renders


@vercel
Copy link

vercel bot commented Jul 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-safe-action-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 15, 2025 10:38am

@vercel
Copy link

vercel bot commented Jul 14, 2025

@rortan134 is attempting to deploy a commit to the Edoardo Ranghieri's projects Team on Vercel.

A member of the Team first needs to authorize it.

* Converts a callback to a ref to avoid triggering re-renders when passed as a
* prop or avoid re-executing effects when passed as a dependency
*/
function useCallbackRef<T extends (arg: any) => any>(callback: T | undefined): T {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheEdoRan TheEdoRan changed the title Fix: Synchronize Callbacks in useActionCallbacks fix(hooks): prevent stale state access in callbacks Jul 15, 2025
@TheEdoRan TheEdoRan linked an issue Jul 15, 2025 that may be closed by this pull request
@TheEdoRan TheEdoRan merged commit 64e85db into TheEdoRan:main Jul 15, 2025
4 of 5 checks passed
@github-actions
Copy link

🎉 This PR is included in version 8.0.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TheEdoRan
Copy link
Owner

Thanks for your contribution @rortan134!

@rortan134 rortan134 deleted the fix-sync-callbacks branch July 15, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Stale state in hook callbacks

2 participants