fix: eliminate guaranteed 404s (ru menaion-bundle, unmapped commemorations)

- loadMenaionBundle: ru resolves to cu bundle (no RU liturgical texts by design)
- autoPreload: fetch cu bundle once; keep ru+cu lives for current month
- calendar view: fetch shared commemorations only for mapped feast CIds
This commit is contained in:
catarrh committed 2026-08-22 00:18:15 +03:00
1 parent c8e11f0af7
commit 610cdca3ad
2 files changed
+8 -4

No files matched your search

+5 -2
View File
@@ -109,9 +109,12 @@ export class App {
const key = 'ponomar-preloaded';
if (localStorage.getItem(key)) return;
const lang = this.settings.language as LanguageCode;
const languages = lang === 'ru' ? ['ru', 'cu'] : [lang];
for (const l of languages) {
const liturgicalLangs = lang === 'ru' || lang === 'cu' ? ['cu'] : [lang];
for (const l of liturgicalLangs) {
await DataCache.fetch(`/data/${l}/menaion-bundle.json`).catch(() => {});
}
const livesLangs = lang === 'ru' ? ['ru', 'cu'] : [lang];
for (const l of livesLangs) {
const mm = String(JDate.today().getMonth()).padStart(2, '0');
await DataCache.fetch(`/data/${l}/lives/${mm}.json`).catch(() => {});
}
+3 -2
View File
@@ -108,7 +108,7 @@ async function loadSharedScriptureIndex(): Promise<Record<string, unknown[]> | n
}
async function loadMenaionBundle(lang: string): Promise<Record<string, unknown> | null> {
const key = lang === 'cu' ? 'cu' : lang;
const key = lang === 'ru' || lang === 'cu' ? 'cu' : lang;
if (menaionBundles.has(key)) return menaionBundles.get(key)!;
try {
const bundle = await DataCache.fetch<Record<string, unknown>>(`/data/${key}/menaion-bundle.json`);
@@ -698,9 +698,10 @@ export class CalendarView {
const sharedComms: Map<string, CommemorationData> = new Map();
for (const cid of cids.slice(0, 30)) {
const sharedId = CID_TO_SHARED_COMM[cid];
const [life, shared] = await Promise.all([
loadLife(this.language, cid),
loadCommemoration(CID_TO_SHARED_COMM[cid] || cid),
sharedId ? loadCommemoration(sharedId) : Promise.resolve(null),
]);
if (life) livesData.set(cid, life);
if (shared) sharedComms.set(cid, shared);