Skip to content

fix: Reload a uno-config.js cached from an earlier deployment - #1108

Merged
MartinZikmund merged 3 commits into
mainfrom
dev/mazi/stale-config-reload
Oct 14, 2026
Merged

MartinZikmund merged 3 commits into
mainfrom
dev/mazi/stale-config-reload

Conversation

@MartinZikmund

Copy link
Copy Markdown
Member

Follow-up to #1077.

Problem

Since #1077, uno-config.js sits next to index.html, outside the hashed package folder. When a host or the browser caches root files, which the template's staticwebapp.config.json does for an hour, a returning visitor can get a fresh index.html with an older uno-config.js. A normal reload revalidates only the page itself. The stale config names the previous package_<hash>, which is usually gone after a redeploy, so the app fails to start.

Fix

After importing ../uno-config.js, the bootstrapper compares the config's uno_app_base folder with the package folder that uno-bootstrap.js was loaded from (the <script type="module"> in index.html). If they differ, it imports ../uno-config.js?v=<package> instead. The query is stable within a deployment, so that copy stays cacheable.

  • No extra request when the config is current.
  • Skipped when uno-bootstrap.js isn't loaded by a script element (embedded mode, custom hosts).
  • A stale copy from a deployment with the same package folder (managed-code-only change) still can't be detected. Spec 008 covers this.

Tests

Uno.Wasm.Tests.ResilientLoading gets a third load where the server answers /uno-config.js (without a query) with another package's name. Without the fix it fails ("did not start within 120s"). With the fix it starts and logs the reload.

Spec: specs/008-root-uno-config/spec.md (FR-2a, edge cases, validation).

🤖 Generated with Claude Code

https://claude.ai/code/session_013terw2KRvw8e64cogQymUL

Copilot AI balanced review requested due to automatic review settings October 8, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/stale-config-reload branch from c52d3e9 to 171e2e1 Compare October 9, 2026 11:44
Copilot AI balanced review requested due to automatic review settings October 9, 2026 11:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mergify

mergify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@MartinZikmund
MartinZikmund merged commit 0eea4b3 into main Oct 14, 2026
15 of 16 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/stale-config-reload branch October 14, 2026 15:21
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.

3 participants