fix(apps): don't serve a cached config form after a deploy

getFieldMappings/getConfigCategories fetched host-GENERATED files with
default caching, so a browser that had the page open before a release
kept rendering the previous release's config UI — a newly shipped field
(UPDATE_TYPE) simply never appeared, with nothing on screen to hint the
page was stale. Only a hard refresh fixed it.

Adds {cache:'no-store'} to both, plus the one configs.json read in this
file that was missing it while two others already had it. Cost is a
conditional request per config-page open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
librelad 2026-08-12 16:22:43 +01:00
parent 3325c53855
commit 8153d82282

View File

@ -993,10 +993,17 @@ Object.assign(AppsManager.prototype, {
return fieldConfig.type === 'checkbox' ? 'false' : '';
},
// Helper methods to load config data (working methods from app-config-original.js)
//
// All three loaders below read HOST-GENERATED files: the generators rewrite
// them on every deploy/regen, so a cached copy silently shows the previous
// release's config UI — a field added this release simply never appears, with
// nothing on screen to suggest the page is stale. `no-store` on all of them
// (matching the configs.json reads elsewhere in this file) costs one small
// conditional request per config-page open and keeps the form honest.
async getConfigCategories() {
try {
// Load config categories (for app config tabs)
const response = await fetch('/data/apps/apps-config-categories.json');
const response = await fetch('/data/apps/apps-config-categories.json', { cache: 'no-store' });
const data = await response.json();
//// // console.log('✅ Loaded config categories from apps folder');
return data.categories || data; // Return the actual data object
@ -1008,7 +1015,7 @@ Object.assign(AppsManager.prototype, {
async getFieldMappings() {
try {
// Load from apps folder (static file)
const response = await fetch('/data/apps/apps-field-mappings.json');
const response = await fetch('/data/apps/apps-field-mappings.json', { cache: 'no-store' });
const data = await response.json();
//// // console.log('✅ Loaded field mappings from apps folder');
return data.fields || data;
@ -1025,7 +1032,7 @@ Object.assign(AppsManager.prototype, {
//// // console.log('🔍 Starting domain fetch...');
// Try to load system config to get domain information
const response = await fetch('/data/config/generated/configs.json');
const response = await fetch('/data/config/generated/configs.json', { cache: 'no-store' });
//// // console.log('📡 Config response status:', response.status);
if (!response.ok) {