Skip to content

fix(auth): recover login page from stale lazy-loaded chunks after logout#560

Open
zhukai9527 wants to merge 1 commit into
iflytek:mainfrom
zhukai9527:fix-login-chunk-recovery
Open

fix(auth): recover login page from stale lazy-loaded chunks after logout#560
zhukai9527 wants to merge 1 commit into
iflytek:mainfrom
zhukai9527:fix-login-chunk-recovery

Conversation

@zhukai9527

@zhukai9527 zhukai9527 commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • Added a client-side recovery helper for stale dynamic import failures in web/src/shared/lib/dynamic-import-recovery.ts.
  • Updated the lazy route loader in web/src/app/router.tsx to detect login-page chunk fetch failures, trigger a one-time full page reload, and clear the reload guard after
    the router resolves normally.
  • This is needed because after logout, the app navigates to the lazily loaded /login route. If the browser is still running an older entry chunk while the server has already deployed a new asset hash, the login chunk request can
    fail until the page is refreshed manually.

错误截图

Validation

  • Backend tests passed
  • Frontend typecheck/build passed
  • OpenAPI SDK regenerated or checked when API contracts changed
  • Smoke test run when relevant

Commands run:

git diff -- web/src/app/router.tsx web/src/shared/lib/dynamic-import-recovery.ts
git checkout -b fix-login-chunk-recovery
git add -- web/src/app/router.tsx web/src/shared/lib/dynamic-import-recovery.ts
git diff --cached -- web/src/app/router.tsx web/src/shared/lib/dynamic-import-recovery.ts
git commit -m "fix(auth): recover from stale login chunks after logout"
git push -u origin fix-login-chunk-recovery
cmd /c pnpm typecheck
cmd /c pnpm test -- src/shared/lib/dynamic-import-recovery.test.ts

## Risk

- User-facing impact: Logout-to-login transitions should self-recover from stale asset hash mismatches instead of showing Failed to fetch dynamically imported module.
- Deployment or migration impact: No backend, schema, or migration impact. Frontend-only runtime behavior change.
- Rollback approach: Revert this commit or redeploy the previous frontend bundle.

## Notes

- Related issue: Logout followed by navigation to /login can fail on deployed environments when lazy-loaded login chunks are stale.
- Follow-up work: Consider tightening static asset and index.html cache strategy at the Nginx/CDN layer to reduce stale entrypoint vs chunk mismatches.
- Docs or operator runbooks updated when behavior changed: No

@CLAassistant

CLAassistant commented Jun 24, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@zhukai9527 zhukai9527 force-pushed the fix-login-chunk-recovery branch from 9d85284 to 92ab2dd Compare June 24, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants