W11-C3: Lazy-loaded page chunks crash to full error boundary when offline — "Try Again" does not re-fetch the chunk, page stays broken #172
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#172
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Issue Summary
When the browser is offline and navigates to a route whose JavaScript chunk has not yet been cached (e.g.
/swap,/charts), the dynamic import fails and the app-levelErrorBoundaryfires, replacing the entire page with a full-screen "SOMETHING WENT WRONG" overlay. Clicking "TRY AGAIN" only resets the boundary's React state — it does not re-trigger the failedimport()— so the error immediately reappears. The trader is permanently stuck until they do a full browser reload.Reproduction Steps
Precondition: The app must already be loaded in the browser before going offline. If the page is loaded while already offline, Chrome shows its own native offline page (dinosaur) — that is browser-level behaviour, not an app issue.
VITE_NETWORK=local npm run dev) and let it fully load on any route (e.g./trade)127.0.0.1:3001(indexer) and set throttling to Offline/swap— a route whose JS chunk has not been loaded yet in this sessionFailed to fetch dynamically imported module: http://localhost:3000/src/pages/SwapPage.tsxNote: If DevTools is open side-by-side and the page is reloaded while offline, Chrome will show its native dinosaur offline page instead of the React app — this is expected browser behaviour. The React error boundary only fires when the app is already running in memory and then tries to lazy-load a new route chunk.
Expected Behavior
Actual Behavior
Suspenselazy loading fails while offline → app-levelErrorBoundarycatches it → full-screen overlay shown.this.setState({ hasError: false, error: null })only — no re-fetch of the failed chunk. Component re-renders and immediately throws again.http://localhost:3000/src/pages/SwapPage.tsx).Screen record
Console Logs
Environment Details
localterra(local Docker), DevTools Offline modeVITE_NETWORK=local npm run devWallet / Device Details
/swap,/charts(any lazily-loaded route not yet in browser cache)Severity / Impact
P2 UX. Any trader who navigates to a fresh route during a connectivity drop hits a full-screen crash with a broken recovery button. The expected CEX-level behaviour is either a graceful "unavailable" message scoped to the route or a working retry. Found under W11-C3 (Contract query failures — Interactivity and Trader use dimensions).
cc: @PlasticDigits
mentioned in issue #116
mentioned in commit
020d8306abmentioned in commit
c55efd5328Fix landed on
main(020d830)@totdking — please verify when you can; leaving the issue open until W11-C3 sign-off.
What changed
LazyRoutewraps every lazy page route: route-scopedErrorBoundary(data-testid="route-error-boundary") keeps header/nav visible instead of a full-screen app crash.loadAttempt, creating a freshReact.lazy(loader)+import()— not only clearing boundary state (root cause of the stuck retry loop).chunkLoadError.tsclassifies dynamic import / chunk failures;humanizeOffChainErrormaps them to retail copy; technical details scrub dev-server URLs.skills/AGENTS_FRONTEND_LAZY_CHUNK_LOAD.md(cross-linked from user-errors + LCD skills).Verification checklist
VITE_NETWORK=local npm run dev— load app on/trade(or any route), wait for full load/charts,/pool) — expect Page unavailable inside main content, not full-screen app overlay; header/nav still visiblelocalhost:3000/src/pages/...raw dev pathscd frontend-dapp && npm run test:unit— includeschunkLoadError.test.ts+LazyRoute.test.tsxAutomated tests run before merge
npm run test:unit(507 tests)npm run buildverified
c55efd5on QA stack.source: new
LazyRoute.tsxwraps lazy chunks inErrorBoundary+Suspense, retries the dynamic import on Try Again click.chunkLoadError.tsdetects fetch failures fromimport().tests:
chunkLoadError.test.ts4/4 PASS +LazyRoute.test.tsx3/3 PASS = 7/7 total. covers retry-after-failure, route-scoped headline, and dynamic import re-run.stderr noise in the run is the test harness deliberately triggering chunk-load failures so the error boundary can catch them - expected for boundary tests.
good to close on your side @PlasticDigits
mentioned in issue #706
mentioned in commit
8c1d1bc5d4