Skip to content

fix(schedule): stop the whole agenda from unmounting on every calendar refetch - #370

Merged
LUPENGHAN merged 2 commits into
1024XEngineer:mainfrom
LUPENGHAN:fix/calendar-loading-flash-on-refetch
Aug 24, 2026
Merged

fix(schedule): stop the whole agenda from unmounting on every calendar refetch#370
LUPENGHAN merged 2 commits into
1024XEngineer:mainfrom
LUPENGHAN:fix/calendar-loading-flash-on-refetch

Conversation

@LUPENGHAN

Copy link
Copy Markdown
Contributor

Fixes #369

Summary

  • useScheduleCalendarloadingoccurrencesLoading || locationsLoadingScheduleCalendarScreen 用它整体包住 agenda 列表——loading 一变 true 就把整个列表卸载换成全屏转圈,数据回来再整个重新挂载。
  • 首次进入页面需要这个转圈,但之后任何一次重取(增删日程、语音写日程、确认提醒)都会重复这个流程,导致整个列表闪一下、丢滚动位置,而不是只更新变化的那一项。
  • 这次改动加了个"是否已完成首次加载"的标记:只有它还没变 true(也就是真的还没数据)时,loading 才会是 true。首次加载完成后就永久锁定,之后的重取只在后台悄悄换 occurrencesByDate/locationSchedules,agenda 不再卸载。
  • 渲染期间同步翻这个标记(不是 useEffect 里 setState),跟这个仓库其他地方处理派生状态的写法一致,也避免多触发一轮级联渲染。

Test plan

  • 新增 useScheduleCalendar.test.ts 用例:首次加载完成后触发 retry(),确认第二次请求已发出但 loading 仍是 false
  • npm run lint / npm run format:check / npm run typecheck / npm run test(jest 713 + vitest 87)全绿。

🤖 Generated with Claude Code

…r refetch

loading was occurrencesLoading || locationsLoading, and the screen
unmounts the entire agenda list whenever loading is true. Every
refetch after the first (create/delete a schedule, a voice write, a
confirm) briefly set it back to true, so the whole list flashed and
remounted instead of just the changed row. loading now only reflects
the very first load; later refetches update data in place.
yyy-router
yyy-router previously approved these changes Aug 24, 2026

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the initial-load transition, background refetch behavior, retry/error paths, and the ScheduleCalendarScreen loading consumer. The successful-first-load refetch path matches issue #369, but the initial-error retry path loses its loading state. git diff --check passes; the focused Jest test suite was not run because dependencies are not installed in the mounted workspace.

Comment thread frontend/src/features/schedule/presentation/useScheduleCalendar.ts
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…fetch fails

initialLoadDone flipped as soon as both requests settled, regardless
of success. If the first load failed, retrying it left loading false,
so the screen rendered the empty/stale agenda instead of the
full-screen first-load state. It now only locks once both requests
succeed.

fennoai review on 1024XEngineer#370.

@yyy-router yyy-router left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@LUPENGHAN
LUPENGHAN merged commit f980f54 into 1024XEngineer:main Aug 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(schedule): calendar agenda list fully unmounts and flashes on every refetch

2 participants