Skip to content

refactor(web): 土台の共通化と重複解消(フェーズ0)#23

Merged
sasagar merged 1 commit into
mainfrom
dev
Jul 25, 2026
Merged

refactor(web): 土台の共通化と重複解消(フェーズ0)#23
sasagar merged 1 commit into
mainfrom
dev

Conversation

@sasagar

@sasagar sasagar commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

挙動不変の純粋リファクタ。差分 +408/-480(純減)、テスト 790 → 848。

  • httpJson(Content-Type 20→0、!res.ok 33→21。status 分岐が必要な経路は挙動維持のため jsonInit のみ)
  • localStore(try/catch 14ブロック撤去、window.localStorage 参照は1箇所に)
  • viewRange(App.tsx の純関数5つを移設・テスト化)
  • 座標変換13箇所を msToTopPx/msRangeToHeightPx に、複合キー16箇所を calendarKey に、Set トグルを setOps に一本化

web 848 tests / typecheck / build clean。

🤖 Generated with Claude Code

https://claude.ai/code/session_01HGESE2zBNzoW8MYvtEySBQ

挙動は一切変えない純粋なリファクタ。差分は +408/-480 で純減、テストは 790 → 848。

- sync/httpJson.ts を新設: CheckedFetch / HttpError(status 付き)/ jsonInit / getJson / postJson /
  putJson / patchJson / deleteJson。Content-Type の定型 20箇所を 0 に、!res.ok throw を 33 → 21。
  401/409/502 を分岐する経路(GitHub 系・tasklists の 403・非 throw フォールバック)は挙動を
  変えないため jsonInit 適用のみに留めた。同期系はエラーメッセージから「どのカレンダーか」が
  消えないよう自前 throw を維持
- layout/localStore.ts を新設: try/catch のコピペ 14 ブロックを全廃し、window.localStorage の
  実参照は1箇所だけになった(CalendarPane の2組はキー名以外バイト同一だった)
- layout/viewRange.ts を新設: dayCountForView / isView / initialTimelineStart / timelineRangeMs を
  App.tsx から移設してテスト可能に。isPaneMode は型の定義元 layout/paneMode.ts へ寄せ、
  isViewAllowedForWidth は既存の keyboard/shortcuts.ts のまま(重複を作らない)
- 座標変換: plannedBlockTopPx/HeightPx を gridMetrics の msToTopPx/msRangeToHeightPx へ移設・改名し、
  手書き計算 13箇所(DayColumn 9 / EventBlock 2 / mapActivity / mapCiRuns)を置換。床(Math.max(…,4))と
  hourHeight 必須引数は維持
- layout/keys.ts を新設: `${accountId}:${calendarId}` の手書き 16箇所 + BlockRulesOverlay の
  プライベート版を置換。Occurrence の optional な id 向けに calendarKeyOf を併設(従来の
  "undefined:undefined" と同じ「どれにも一致しない」挙動を明記)
- Set トグルを setOps に一本化(toggleSetMember を移設)し、手書きトグル4箇所を置換。
  「変化が無ければ同参照」の再レンダー抑制性質は維持。これに伴い一部の state/prop 型を
  Set → ReadonlySet に(型のみ、実行時挙動なし)

web 848 tests, typecheck/build clean。lint 警告は変更前と同一(既存分のみ)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGESE2zBNzoW8MYvtEySBQ
@sasagar
sasagar merged commit ea8239c into main Jul 25, 2026
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.

1 participant