next.js
1e113cf5 - Fix stale data after navigation despite revalidation (#95439)

Commit
11 hours ago
Fix stale data after navigation despite revalidation (#95439) Claude noticed this while working on https://github.com/vercel/next.js/pull/95391. Basically, the queue's React state always gets updated in the order of dispatching. So if a navigation displaced pending actions, it's the *navigation's* promise that was last. So when the pending action runs after it, that action's state is no longer taken into account, even if it revalidated. This is why the new data won't reflect on the screen. With the fix, the final state is properly reflected. ## Test Plan New test, which was red before the fix. Also tried it on a mini-app. Before: https://github.com/user-attachments/assets/2235b116-82c4-4ef4-a63c-78e157c90470 After: https://github.com/user-attachments/assets/d7b685c7-d0a5-4b91-8da7-78bb14011313 ## How We re-render at the end with the final queue state — if we know it was preempted.
Author
Parents
Loading