Skip to content

improve(pages): simplify ErrorBoundary reload UX and add unit tests - #565

Merged
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
wangqiao258:improve/errorboundary-reload-ux
Jul 29, 2026
Merged

improve(pages): simplify ErrorBoundary reload UX and add unit tests#565
lizhengfeng101 merged 1 commit into
alibaba:mainfrom
wangqiao258:improve/errorboundary-reload-ux

Conversation

@wangqiao258

Copy link
Copy Markdown
Contributor

Description

Simplify the ErrorBoundary reload UX: replace the indirect reset-and-catch reload cycle with a direct window.location.reload() after clearing the session guard. Scoped to the RouteErrorFallback Reload button (verified reset() is not called elsewhere -- HeroSection uses a static fallback). Also adds the first unit-test coverage for ErrorBoundary (4 scenarios) by introducing vitest + @testing-library/react + jsdom for pages/.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

npm run typecheck, npm run lint (0 errors; 2 pre-existing warnings in HeroSection/MarkdownRenderer, unrelated), npm run build, npm run size (82.15 kB < 150 kB) all pass from pages/. npm run test (vitest) -- 4/4 tests pass.

Checklist

  • My code follows the project's coding style (go fmt, go vet) (pages/ uses eslint; npm run lint passes)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable) (no docs affected)
  • I have signed the CLA (will sign via CLA bot once this PR is opened)

Related Issues

Closes #544

Closes alibaba#544

- Change RouteErrorFallback reload to call window.location.reload() directly after clearing the session guard

- Add vitest + @testing-library/react + jsdom test infrastructure for pages/

- Add ErrorBoundary.test.tsx covering 4 scenarios (chunk error reload, guard prevents double reload, non-chunk error shows fallback, reset clears guard and reloads)
@CLAassistant

CLAassistant commented Jul 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

OpenCodeReview: No comments generated. Looks good to me.

@lizhengfeng101 lizhengfeng101 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lizhengfeng101
lizhengfeng101 merged commit fc2c110 into alibaba:main Jul 29, 2026
9 checks passed
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.

improve(pages): simplify ErrorBoundary reload UX and add unit tests

3 participants