Commit f1e9308
committed
fix(demo): cache-bust vocab JS + defensive fallback when loadFromFlatFreq missing
Yesterday's switch to the APK dict required a new
SwipeVocabulary.loadFromFlatFreq method. Fastly/Cloudflare and the
browser both cache swipe-vocabulary.js for 4 h (max-age=14400), so
users who had /demo/ open — or who hit the edge cache before it
invalidated — got a stale JS without the new method, producing
"swipeVocabulary.loadFromFlatFreq is not a function" on load.
Two defenses:
- Version-query the demo's three support scripts (swipe-vocabulary,
custom-dictionary, niche-words-loader). Future JS changes bump
the `?v=` token, forcing both the CDN and the browser to fetch
fresh.
- In loadVocabulary(), typeof-check the method before calling it;
if an ancient cached version is somehow still loaded, silently
fall back to loadFromJSON (the 150k vocab) instead of hard-failing.
— opus 4.71 parent 58df5d5 commit f1e9308
1 file changed
Lines changed: 14 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | | - | |
| 15 | + | |
14 | 16 | | |
15 | | - | |
| 17 | + | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
| |||
730 | 732 | | |
731 | 733 | | |
732 | 734 | | |
733 | | - | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
734 | 744 | | |
735 | 745 | | |
736 | 746 | | |
| |||
0 commit comments