Repository navigation
Conversation
The `_auth` and dashboard chunks only start after `requireIdentity` resolves. Start them at boot for a visitor whose local record names a live session. Guards and loaders run as before, so the auth result and the data order do not change.
|
✅ No security or compliance issues detected. Reviewed everything up to 8c69e16. Security OverviewDetected Code Changes
|
📊 Build Bundle StatsThe latest build generated the following assets: |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Stored-session redirects to /voting download unused dashboard chunks while the voting chunk waits for identity restoration, defeating the optimization and adding competing downloads.
1 open issue
What changed in this PR
This PR reduces startup delays for visitors with stored sessions by downloading matched route chunks while identity restoration is pending.
Changes:
- Adds a synchronous stored-session hint from the auth client.
- Starts route-chunk preloading at boot without running guards or data loaders.
- Adds tests for session hints, route matching, and failed-chunk retries.
| File | Description |
|---|---|
src/governance-app-frontend/src/main.tsx |
Starts route-chunk preloading before mounting the app. |
src/governance-app-frontend/src/common/utils/router.ts |
Preloads matched route chunks for stored sessions. |
src/governance-app-frontend/src/common/utils/router.test.ts |
Tests chunk selection, guard isolation, and retries. |
src/governance-app-frontend/src/common/auth/internetIdentity.ts |
Exposes the synchronous stored-session hint. |
src/governance-app-frontend/src/common/auth/internetIdentity.test.ts |
Tests session hints during initialization and client creation failure. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
The
_authand dashboard chunks (25 files) start only afterrequireIdentityresolves. A visitor with a stored session now downloads them during that wait. This is item F4 of the September audit.Median of 15 runs, in ms. Local production build over HTTP/2 with a throwaway session, because no signed-in Chrome was available. The 2 s wait is a simulated Internet Identity mint.
/The audit gap of 669 ms did not reproduce. Here the gap is about 75 ms, so a warm desktop load gains nothing.
Changes
hasStoredSession, a synchronous hint from the auth client.preloadSessionRouteChunks, whichmain.tsxcalls at boot./preloads its redirect target, or the dashboard.