feat: serve all precached data offline via DataCache fallback

- DataCache.fetchWithFallback: network-first with IDB write-through under
  the same url: keys the preload writes; falls back to precached IDB copy
  when offline — closes the preload(IDB) vs read(SW cache) gap that made
  the Bible reader (and every other view) fail offline despite precaching
- Convert all 33 raw /data fetches across bible/service/menaion/prayer/
  calendar/settings views; in-memory caches and notFound maps preserved
- fetchCommandText: switch to lowercase services/commands/ (already in
  preload manifest); tolerate both TEXT/text node casings per migrate-data
- Remove stale duplicate static/data/en/services/Command/ (15 files)
- fetchLives: fix misc fallback to real lives/misc/{N}.json bundles
This commit is contained in:
catarrh committed 2026-08-24 09:50:07 +03:00
1 parent 623c56a96f
commit a005e386a6
22 files changed
+118 -198

No files matched your search

+3 -3
View File
@@ -8,6 +8,7 @@ import { assembleService, type ServiceContext } from '../core/service-assembler'
import type { EvalContext, ServiceNode } from '../core/types';
import { getTranslations, type LanguageCode } from '../core/i18n';
import { loadSettings, fontClass } from './settings-view';
import { DataCache } from '../core/data-cache';
export type PrayerCollection = 'prayer-rule' | 'akathists' | 'parimii' | 'horologion' | 'sbornik' | 'paraclete' | 'irmologion' | 'triodion';
@@ -270,12 +271,11 @@ export class PrayerView {
}
dataPath = `/data/shared/services/paraclete/tone${m[1]}/${m[2]}.json`;
}
const resp = await fetch(dataPath);
if (!resp.ok) {
const nodes = await DataCache.fetchWithFallback<ServiceNode[]>(dataPath);
if (!nodes) {
contentEl.innerHTML = `<p class="text-navy-light">${this.t.prayer.notFound}</p>`;
return;
}
const nodes: ServiceNode[] = await resp.json();
const evalCtx: EvalContext = {};
const ctx: ServiceContext = {