Commit d71da53
fix: wait for async loaders before executing head functions
The bug: When loaders run asynchronously (stale-while-revalidate),
loadRouteMatch returns immediately while the loader runs in the background.
Promise.allSettled(inner.matchPromises) waits for loadRouteMatch promises,
not the actual loader completion, causing head() to execute with undefined
loaderData.
The fix: After loadRouteMatch promises settle, explicitly wait for all
loaderPromises to complete before executing head functions. This ensures
loaderData is available when head() executes.
Reproduction scenario:
1. Navigate to authenticated route (e.g., /article/123)
2. Delete auth cookie, reload (shows 'not found')
3. Login, redirect to dashboard
4. Click back button to /article/123
- Before fix: Article loads but title shows fallback (loaderData undefined)
- After fix: Article loads with correct title (loaderData available)
Fixes the issue identified in PR #6093 follow-up investigation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 71e560d commit d71da53
1 file changed
+10
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
900 | 900 | | |
901 | 901 | | |
902 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
903 | 913 | | |
904 | 914 | | |
905 | 915 | | |
| |||
0 commit comments