Merged
Conversation
- サイドバーに TeamSwitcher コンポーネントを追加(OrgSwitcher の下に配置) - team-cookie.server.ts でサーバーサイドの Cookie 読み取りを実装 - 7 ページの loader で Cookie をフォールバックとして使用(URL ?team > Cookie) - 各ページの PageHeaderActions から TeamFilter を削除 - listTeams を layout loader に集約し、各ページでの重複呼び出しを排除 Closes #259 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Caution Review failedPull request was closed or merged during review 📝 WalkthroughWalkthroughチーム選択をグローバル化し、Cookie で永続化する機能を実装。サイドバーに TeamSwitcher コンポーネントを追加し、ミドルウェアで teamContext を導入。複数の分析・スループット・ワークロードページから TeamFilter を削除し、各ページの team パラメータを URL クエリから teamContext に統一。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SideBar as Sidebar<br/>TeamSwitcher
participant Client as Client Page
participant Middleware as Middleware
participant Cookie as Cookie Storage
participant Context as teamContext
participant Loader as Route Loader
User->>SideBar: チーム選択変更
SideBar->>Cookie: Cookie 更新<br/>(selected_team=teamId)
SideBar->>Client: Remix revalidation<br/>トリガー
Client->>Middleware: リクエスト送信
Middleware->>Cookie: Cookie から<br/>selectedTeamId 読取
Middleware->>Context: teamContext に<br/>selectedTeamId 保存
Middleware->>Loader: コンテキスト付き
Loader->>Context: teamContext から<br/>team パラメータ取得
Loader->>Client: ローダーデータ返却
Client->>Client: チームに基づいて<br/>データ再表示
Note over SideBar,Loader: 複数ページ間でチーム<br/>選択が同期される
sequenceDiagram
participant User
participant Browser as ブラウザ
participant Layout as Layout Route
participant OrgMember as org-member<br/>Middleware
participant TeamDB as Teams API
participant Component as AppSidebar<br/>TeamSwitcher
User->>Browser: $orgSlug ページへアクセス
Browser->>OrgMember: リクエスト処理開始
OrgMember->>Browser: URL ?team パラメータ<br/>チェック
OrgMember->>Browser: Cookie から<br/>selected_team 読取
OrgMember->>TeamDB: organization.teams 取得
OrgMember->>OrgMember: selectedTeamId 決定<br/>(URL > Cookie > null)
OrgMember->>Browser: teamContext に<br/>保存
Browser->>Layout: ローダー実行
Layout->>OrgMember: teamContext.get()
Layout->>TeamDB: listTeams()
Layout->>Component: teams + selectedTeamId<br/>を props で渡す
Component->>Browser: SideBar 内に<br/>TeamSwitcher 描画
Browser->>User: 現在チーム表示
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
既存の sidebar.tsx と同じ document.cookie パターンのため biome-ignore で抑制。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
GitHub App Installation Token の API 検証用スクリプト。 検証完了済みのため削除。lint warning 5件も解消。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
DropdownMenu + SidebarMenuButton の組織スイッチャー風から、 Select + UsersIcon のシンプルな見た目に変更。 サイドバー内での視覚的階層を適切にする。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Cookie 名・max-age を共有定数ファイル (team-cookie.ts) に抽出 - team-cookie.server.ts が共有定数を import - team-switcher.tsx が共有定数を import(stringly-typed 重複を解消) - orgMemberMiddleware で teamContext をセット - URL ?team > Cookie の優先順位で解決 - teams リストで検証済み(stale cookie で空データになるバグを修正) - 7 ページの loader から getSelectedTeam(request) を排除 → context.get(teamContext) に統一 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- split('=')[1] → slice(prefix.length) で = を含む値も正しく取得
- decodeURIComponent を try-catch で囲み malformed 入力で null を返す
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
selected_teamCookie でチーム選択を永続化(7日間)?teamパラメータがある場合はそちらを優先listTeamsを layout loader に集約(各ページでの重複呼び出し排除)Changes
app/libs/team-cookie.server.ts— サーバーサイド Cookie 読み取りapp/components/layout/team-switcher.tsx— サイドバー TeamSwitcher コンポーネントapp/routes/$orgSlug/_layout.tsx— layout loader で teams 取得、sidebar に渡すapp/components/layout/app-sidebar.tsx— TeamSwitcher 配置Test plan
pnpm validateが通る?team=xxxがある場合は Cookie より優先されるCloses #259
Generated with takt (spec-implement-accept piece)
Summary by CodeRabbit
新機能
リファクタリング