CRITICAL: Fix script load order (app.js before Alpine)#29
Merged
Conversation
app.js was at line 1639 (end of body) while Alpine was at line 174 (head). Both had defer, and defer scripts execute in document order -- so Alpine ran first, tried to call siteApp(), and failed because app.js hadn't executed yet. This broke the entire site (not just dark mode -- tabs, charts, role selector, everything). Fix: move app.js to <head> BEFORE Alpine's script tag. Defer order is now: app.js -> Alpine -> ECharts. Remove the duplicate reference at end of body. Also bumped SW cache name to sp-v3.0.1 and version meta to 3.0.1.
This was referenced May 27, 2026
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.
Critical fix
The entire site was broken, not just dark mode. Root cause:
app.jswas at the end of<body>(line 1639) while Alpine was in<head>(line 174). Both useddefer, and defer scripts execute in document order — so Alpine ran first, tried to callsiteApp(), and failed becauseapp.jshadn't loaded yet. Result: no tabs, no charts, no dark mode, no role selector, nothing.Fix
Move
<script defer src="app.js">to<head>, before the Alpine script. Defer order is now:app.js(definessiteApp(),FALLBACK_DATA, helpers)x-data="siteApp()", binds everything)Remove the duplicate
app.jsreference that was at end of body.Test plan
Generated by Claude Code