Repository navigation
fix(server): retry a lazy router load after it rejects - #8150
Conversation
Regression check: packages/tests/server/regression/issue-8149-lazy-router-retry.test.ts catches a cached rejection preventing later loads. Co-authored-by: Devin <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@Kulraj69 is attempting to deploy a commit to the trpc Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
trpc-bot
left a comment
There was a problem hiding this comment.
The new test fails on main (the second call rejects with Loading failed) and passes here.
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
A
lazy()router whose loader rejects once never loads again:once()keeps the rejected promise, so every later call rethrows the same error until the process restarts.What
once()inrouter.tsdrops the cached promise when it rejects, so the next call runs the loader again.Links
None
Alternatives considered
lazy()instead of changingonce():once()is only used for lazy loads, so fixing it there is simpler.Testing
Regression check:
packages/tests/server/regression/issue-8149-lazy-router-retry.test.tsfails without the fix (the second call still rejects with the first error) and passes with it. It also checks a successful load and a concurrent load each call the loader once.AI model
Devin (Cognition AI) wrote this change.
Summary by CodeRabbit