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:
1 parent
c8e11f0af7
commit
610cdca3ad
2 files changed
+8
-4
No files matched your search
+5
-2
@@ -109,9 +109,12 @@ export class App {
|
|||||||
const key = 'ponomar-preloaded';
|
const key = 'ponomar-preloaded';
|
||||||
if (localStorage.getItem(key)) return;
|
if (localStorage.getItem(key)) return;
|
||||||
const lang = this.settings.language as LanguageCode;
|
const lang = this.settings.language as LanguageCode;
|
||||||
const languages = lang === 'ru' ? ['ru', 'cu'] : [lang];
|
const liturgicalLangs = lang === 'ru' || lang === 'cu' ? ['cu'] : [lang];
|
||||||
for (const l of languages) {
|
for (const l of liturgicalLangs) {
|
||||||
await DataCache.fetch(`/data/${l}/menaion-bundle.json`).catch(() => {});
|
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');
|
const mm = String(JDate.today().getMonth()).padStart(2, '0');
|
||||||
await DataCache.fetch(`/data/${l}/lives/${mm}.json`).catch(() => {});
|
await DataCache.fetch(`/data/${l}/lives/${mm}.json`).catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ async function loadSharedScriptureIndex(): Promise<Record<string, unknown[]> | n
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function loadMenaionBundle(lang: string): Promise<Record<string, unknown> | null> {
|
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)!;
|
if (menaionBundles.has(key)) return menaionBundles.get(key)!;
|
||||||
try {
|
try {
|
||||||
const bundle = await DataCache.fetch<Record<string, unknown>>(`/data/${key}/menaion-bundle.json`);
|
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();
|
const sharedComms: Map<string, CommemorationData> = new Map();
|
||||||
|
|
||||||
for (const cid of cids.slice(0, 30)) {
|
for (const cid of cids.slice(0, 30)) {
|
||||||
|
const sharedId = CID_TO_SHARED_COMM[cid];
|
||||||
const [life, shared] = await Promise.all([
|
const [life, shared] = await Promise.all([
|
||||||
loadLife(this.language, cid),
|
loadLife(this.language, cid),
|
||||||
loadCommemoration(CID_TO_SHARED_COMM[cid] || cid),
|
sharedId ? loadCommemoration(sharedId) : Promise.resolve(null),
|
||||||
]);
|
]);
|
||||||
if (life) livesData.set(cid, life);
|
if (life) livesData.set(cid, life);
|
||||||
if (shared) sharedComms.set(cid, shared);
|
if (shared) sharedComms.set(cid, shared);
|
||||||
|
|||||||
Reference in new issue
Block a user