Skip to content

refactor(checkin): propagate useApiResource + add background reload#44

Merged
ut42tech merged 12 commits into
developfrom
refactor/checkin-data-layer
Jun 2, 2026
Merged

refactor(checkin): propagate useApiResource + add background reload#44
ut42tech merged 12 commits into
developfrom
refactor/checkin-data-layer

Conversation

@ut42tech
Copy link
Copy Markdown
Owner

@ut42tech ut42tech commented Jun 2, 2026

概要

checkin の手書き fetch ステートマシン 5 箇所を共有 useApiResource に統合し、ほぼ同一だった全画面エラー 4 箇所を checkin-local の CheckinErrorScreen に集約。あわせて共有フックに 後方互換の reload({ background })(stale-while-revalidate)を追加し、history の「更新」と admin の更新/ミューテーション後再取得のスケルトンちらつきを解消した。挙動・エンドポイント・debounce・motion・キオスク UX・表示文言は不変。signage と認証は対象外。

設計: docs/superpowers/specs/2026-06-02-checkin-data-layer-propagation-design.md
計画: docs/superpowers/plans/2026-06-02-checkin-data-layer-propagation.md

変更内容

  • packages/ui: useApiResourcereload({ background }) を追加(既存呼び出しは引数なしのため挙動不変)。
  • apps/checkin: 新規 CheckinErrorScreen/5 ページ移行(first-time・history・reception/[id]・manual・guideline)。AbortControllercache:'no-store'・fetch 用 type State を撤去。複合ステート(reception=Action/guideline=MutationState)は取得状態と分離。
  • apps/admin: dashboard 更新 + mentors/pre-registrations のミューテーション後再取得(計 6 箇所)を reload({ background: true }) に。

検証

  • pnpm --filter @tecnova/ui --filter checkin --filter admin type-check green、pnpm biome check(85 files)clean。
  • 各タスクで spec 準拠+コード品質レビュー、ブランチ全体レビュー済み(リグレッション無し)。
  • ⚠️ 自動 Playwright スモークは未実施(ローカル dev サーバー稼働中のため)。マージ前に手動スモーク推奨。

マージ順

単独 PR(スタックしない)。develop 直接。

🤖 Generated with Claude Code

ut42tech and others added 11 commits June 2, 2026 22:54
Migrate checkin's 5 hand-rolled GET fetch state machines to the shared
useApiResource hook (from #43), and consolidate the 4 near-identical
full-screen error screens into a checkin-local CheckinErrorScreen.
Loading skeletons stay content-aware/page-local; signage stays as-is
(polling). Auth untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The shared useApiResource gains a backward-compatible reload({ background })
(stale-while-revalidate); history's 更新 and admin's refresh/mutation
refetch opt in to avoid the skeleton flash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ource

reload({ background: true }) keeps current data visible during refetch
instead of flipping to loading, for flicker-free refresh buttons.
Backward compatible: default is the existing loading behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rors

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… refresh)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…refetch

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tecnova-platform-admin Ready Ready Preview, Comment Jun 2, 2026 3:56pm
tecnova-platform-checkin Ready Ready Preview, Comment Jun 2, 2026 3:56pm
tecnova-platform-signage Ready Ready Preview, Comment Jun 2, 2026 3:56pm

The prune useEffect depended on presentIdSet, which is recreated every
render while state != ok (sessions = data?.sessions ?? [] makes a fresh
[] each render), so the effect ran every render and setSelectedIds
(ids.filter always returns a new array) re-rendered forever — "Maximum
update depth exceeded" on the loading screen.

The effect was also redundant: selectedPresentIds already filters
selectedIds by presentIdSet at use-time, and every consumer (count,
checkbox state, checkout) reads the present-filtered value, so stale
stored selections are inert. Deleting the effect fixes the loop with no
behavioral change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ut42tech
Copy link
Copy Markdown
Owner Author

ut42tech commented Jun 2, 2026

@copilot This is MAJOR UPDATE, right? please CONFIRM that there is NO fatal bug. ok?

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

@copilot This is MAJOR UPDATE, right? please CONFIRM that there is NO fatal bug. ok?

現時点の検証では fatal bug は検出されていません。根拠として、develop 側の直近 CI はすべて success、このブランチの CI も success、さらにローカルで pnpm --filter @tecnova/ui --filter checkin --filter admin type-checkpnpm lint を再実行してともに通過しています。

@ut42tech ut42tech merged commit 45dcd3e into develop Jun 2, 2026
6 checks passed
@ut42tech ut42tech deleted the refactor/checkin-data-layer branch June 2, 2026 16:52
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.

2 participants