next.js
5f6aa1cb - Fix: server-patch retry preserves push/replace intent of suspended transitions (#90533)

Commit
60 days ago
Fix: server-patch retry preserves push/replace intent of suspended transitions (#90533) When a navigation triggers a server-patch retry (due to a route tree mismatch), the retry was unconditionally using navigateType='replace'. This assumed the original navigation had already committed to the browser history. But if the original transition was still suspended, pushState never ran, so replaceState overwrote the initial history entry instead of creating a new one, breaking the back button. The fix tracks the last committed router tree. When a server-patch retry fires, it checks whether the original navigation has committed. If not, it inherits the original transition's push/replace intent instead of forcing 'replace'. This works because React entangles the retry with the original pending transition — they commit together. Fixes #90513
Author
Parents
Loading