perf: streamline view data loading
ci / gitleaks (push) Successful in 7s
ci / docker (push) Successful in 3m29s

This commit is contained in:
2026-09-10 08:06:52 +08:00
parent a5ece8ca42
commit 98578b4f36
7 changed files with 545 additions and 75 deletions
+8 -5
View File
@@ -44,12 +44,15 @@ describe('countdown modal accessibility', () => {
expect(source).toContain(':disabled="form.ignore_year"')
})
it('shows cached countdowns immediately and refreshes active items first', () => {
it('shows cached countdowns immediately and shares one fresh/in-flight refresh', () => {
expect(source).toContain('readCountdownCache<Countdown>()')
expect(source).toContain("const active = await request('/countdowns')")
expect(source).toContain("const archivedItems = await request('/countdowns?archived=true')")
expect(source).toContain('writeCountdownCache(items.value, archived.value)')
expect(source).not.toContain("Promise.all([request('/countdowns'),request('/countdowns?archived=true')])")
expect(source).toContain('loadCountdownCache(fetchCountdowns, { force })')
expect(source).toContain("request('/countdowns') as Promise<Countdown[]>")
expect(source).toContain("request('/countdowns?archived=true') as Promise<Countdown[]>")
expect(source).toContain('const generation = getCountdownCacheGeneration()')
expect(source).toContain('if (!isCountdownCacheGenerationCurrent(generation)) return')
expect(source).toContain('if (isCountdownCacheGenerationCurrent(generation)) error.value=')
expect(source).toContain('if (isCountdownCacheGenerationCurrent(generation)) busy.value=false')
})
it('prevents duplicate submits and sends the edit precondition', () => {