Commit Graph

3 Commits

Author SHA1 Message Date
Sebastian "Sebbie" Silbermann 0b58a32c45 [test] assert* -> waitFor* when the util is not instant (#85450) 2025-10-30 14:44:08 +01:00
Zack Tanner 1bca3db0bf fix: redirect should always return updated router state (#85533)
When a server action triggers a redirect, it will return the RSC payload
for the destination state in a single roundtrip. This lets us update the
UI without needing to waterfall when getting the target page's data. We
reject the server action with a special error signaling that the form
state should be reset, but otherwise the redirect itself is unnecessary,
since we already are handling it in the server action reducer.

However, when we introduced Activity for bfCache, this meant navigating
back to the previous page would replay the redirect error that was
stashed in the `RedirectBoundary`. I incorrectly patched this by just
returning the current router state, rather than the redirect
destination's state, but this lost the ability to return the updated
state in the same roundtrip as the redirect. Instead, this marks the
error that gets stashed in the `RedirectBoundary` as being "handled".
Re-activating the hidden subtree will now still correctly reset the
state (because the boundary handles it), but won't attempt to perform
the redirect again.

Closes NAR-470
2025-10-29 16:02:16 -07:00
Zack Tanner 5dcfec401a Add refresh API to next/cache (#84666)
This provides a way to refresh the client cache from within a server
action. This is useful when you need to refresh the client UI / read
your writes without needing to rely on `updateTag`.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-10-09 11:47:51 -07:00