Yuki Takei 6 месяцев назад
Родитель
Сommit
50606d33a3

+ 0 - 404
.serena/memories/apps-app-jotai-migration-guidelines.md

@@ -1,404 +0,0 @@
-# Jotai 移行技術ガイドライン
-
-## 🎯 移行方針と基本原則
-
-### 移行の背景
-- `useSWRStatic` や `useContextSWR` による複雑な状態管理の課題解決
-- パフォーマンス改善と責務の明確化
-
-### 役割分担の明確化
-- **SWR**: データフェッチング、サーバーキャッシュ管理に特化
-- **Jotai**: クライアントサイドUI状態、同期的な状態管理に特化
-
-## ⚠️ 移行作業フロー(必須手順)
-
-### 基本手順(必ず順序通りに実行)
-1. **新しいJotaiベースの実装を作成**
-2. **使用箇所を新しい実装に置き換え**
-3. **【必須】旧コードの削除** ← これを忘れずに!
-4. **【必須】型チェックの実行** ← migration完了確認
-
-```bash
-# 型チェック実行(migration完了確認)
-cd /workspace/growi-use-jotai/apps/app && pnpm run lint:typecheck
-```
-
-### ⚠️ 旧コード削除が必須な理由
-- **Migration完了の確認**: 旧コードが残っていると、移行が不完全でもtypecheckがパスしてしまう
-- **コンパイルエラーによる検証**: 旧コードを削除することで、移行漏れが確実に検出される
-- **保守性の向上**: 重複コードがないことで、将来の変更時の混乱を防ぐ
-
-## 🆕 **Derived Atom採用ガイドライン**
-
-### 🎯 Derived Atom vs Direct Hook判定基準
-
-#### **Derived Atom化すべき条件(優先度順)**
-1. **複雑な計算ロジック**: 依存関係4個以上
-2. **高頻度での使用**: レンダリング回数が多い箇所で使用
-3. **複数コンポーネントでの共有**: 計算結果を複数箇所で使用
-4. **パフォーマンス要求**: 計算コストが高い
-
-#### **Direct Hook維持すべき条件**
-1. **シンプルな計算**: 依存関係2-3個以下
-2. **低頻度での使用**: 特定条件下でのみレンダリング
-3. **単一コンポーネント使用**: 計算結果共有の必要なし
-4. **パフォーマンス要求低**: 計算コストが軽微
-
-### 🏗️ **Derived Atom実装パターン**
-
-#### **特殊名Export方式(必須パターン)**
-```typescript
-// ~/states/page/internal-atoms.ts
-export const _atomsForDerivedAbilities = {
-  pageNotFoundAtom,
-  currentPagePathAtom,
-  isIdenticalPathAtom,
-  // ... 必要な内部atom
-} as const;
-
-// ~/states/page/index.ts(公開API)
-export { _atomsForDerivedAbilities } from './internal-atoms';
-```
-
-#### **Derived Atom + Hook実装**
-```typescript
-// Import internal atoms with special naming
-import { _atomsForDerivedAbilities as pageAtoms } from '~/states/page';
-import { _atomsForDerivedAbilities as editorAtoms } from '~/states/ui/editor';
-
-// Derived atom(内部実装)
-const isAbleToShowTagLabelAtom = atom((get) => {
-  const isNotFound = get(pageAtoms.pageNotFoundAtom);
-  const currentPagePath = get(pageAtoms.currentPagePathAtom);
-  const isIdenticalPath = get(pageAtoms.isIdenticalPathAtom);
-  const shareLinkId = get(pageAtoms.shareLinkIdAtom);
-  const editorMode = get(editorAtoms.editorModeAtom);
-
-  // undefined判定(必須)
-  if ([currentPagePath, isIdenticalPath, isNotFound, editorMode].some(v => v === undefined)) {
-    return false;
-  }
-
-  // ビジネスロジック
-  const isViewMode = editorMode === EditorMode.View;
-  return !isUsersTopPage(currentPagePath!) && !isTrashTopPage(currentPagePath!)
-    && shareLinkId == null && !isIdenticalPath && !(isViewMode && isNotFound);
-});
-
-// Public hook(外部API)
-export const useIsAbleToShowTagLabel = (): boolean => {
-  return useAtomValue(isAbleToShowTagLabelAtom);
-};
-```
-
-## 🎯 確立された実装パターン
-
-### 1️⃣ **パフォーマンス最適化フック分離パターン**
-```typescript
-// 状態型定義
-export type [Modal]Status = {
-  isOpened: boolean;
-  // その他のプロパティ
-};
-
-export type [Modal]Actions = {
-  open: (...args) => void;
-  close: () => void;
-};
-
-// Atom定義
-const [modal]Atom = atom<[Modal]Status>({ isOpened: false });
-
-// 読み取り専用フック(useAtomValue使用)
-export const use[Modal]Status = (): [Modal]Status => {
-  return useAtomValue([modal]Atom);
-};
-
-// アクション専用フック(useSetAtom + useCallback)
-export const use[Modal]Actions = (): [Modal]Actions => {
-  const setStatus = useSetAtom([modal]Atom);
-
-  const open = useCallback((...args) => {
-    setStatus({ isOpened: true, ...args });
-  }, [setStatus]);
-
-  const close = useCallback(() => {
-    setStatus({ isOpened: false });
-  }, [setStatus]);
-
-  return { open, close };
-};
-```
-
-### 2️⃣ **デバイス状態パターン(Jotaiベース)**
-```typescript
-// 例: useDeviceLargerThanMd
-export const isDeviceLargerThanMdAtom = atom(false);
-
-export const useDeviceLargerThanMd = () => {
-  const [isLargerThanMd, setIsLargerThanMd] = useAtom(isDeviceLargerThanMdAtom);
-
-  useEffect(() => {
-    if (isClient()) {
-      const mdOrAboveHandler = function (this: MediaQueryList): void {
-        setIsLargerThanMd(this.matches);
-      };
-      const mql = addBreakpointListener(Breakpoint.MD, mdOrAboveHandler);
-      setIsLargerThanMd(mql.matches); // initialize
-      return () => {
-        cleanupBreakpointListener(mql, mdOrAboveHandler);
-      };
-    }
-    return undefined;
-  }, [setIsLargerThanMd]);
-
-  return [isLargerThanMd, setIsLargerThanMd] as const;
-};
-```
-
-### 3️⃣ **RefObjectパターン(DOM要素管理)**
-```typescript
-// Internal atom for RefObject storage
-const tocNodeRefAtom = atom<RefObject<HtmlElementNode> | null>(null);
-
-// Public derived atom for direct access
-export const tocNodeAtom = atom((get) => {
-  const tocNodeRef = get(tocNodeRefAtom);
-  return tocNodeRef?.current ?? null;
-});
-
-// Hook for setting with RefObject wrapping
-export const useSetTocNode = () => {
-  const setTocNodeRef = useSetAtom(tocNodeRefAtom);
-
-  const setTocNode = useCallback((newNode: HtmlElementNode) => {
-    const nodeRef: RefObject<HtmlElementNode> = { current: newNode };
-    setTocNodeRef(nodeRef);
-  }, [setTocNodeRef]);
-
-  return setTocNode;
-};
-```
-
-### 4️⃣ **Dynamic Import + Cachingパターン**
-```typescript
-// Cache for dynamic import
-let generateTocOptionsCache: typeof generateTocOptions | null = null;
-
-export const useTocOptions = () => {
-  // ... dependencies ...
-  
-  useEffect(() => {
-    (async () => {
-      try {
-        if (!generateTocOptionsCache) {
-          const { generateTocOptions } = await import('~/client/services/renderer/renderer');
-          generateTocOptionsCache = generateTocOptions;
-        }
-        
-        const data = generateTocOptionsCache(config, tocNode);
-        setState({ data, isLoading: false, error: undefined });
-      } catch (err) {
-        setState({ data: undefined, isLoading: false, error: err instanceof Error ? err : new Error('Failed') });
-      }
-    })();
-  }, [dependencies]);
-};
-```
-
-### 5️⃣ **シンプルBoolean状態パターン**
-```typescript
-// Atom定義
-const isUntitledPageAtom = atom<boolean>(false);
-
-// 読み取り専用フック
-export const useIsUntitledPage = (): boolean => {
-  return useAtomValue(isUntitledPageAtom);
-};
-
-// セッター専用フック(シンプル)
-export const useSetIsUntitledPage = () => {
-  return useSetAtom(isUntitledPageAtom);
-};
-```
-
-### 6️⃣ **server-configurations直接Atomパターン**
-```typescript
-// server-configurations/server-configurations.ts
-export const auditLogEnabledAtom = atom<boolean>(false);
-export const activityExpirationSecondsAtom = atom<number>(0);
-export const auditLogAvailableActionsAtom = atom<SupportedActionType[]>([]);
-
-// 使用側(hooksは不要)
-import { auditLogEnabledAtom } from '~/states/server-configurations';
-import { useAtomValue } from 'jotai';
-
-const auditLogEnabled = useAtomValue(auditLogEnabledAtom);
-```
-
-### 7️⃣ **機能別専用statesパターン**
-```typescript
-// features/openai/client/states/unified-merge-view.ts
-const isEnableUnifiedMergeViewAtom = atom<boolean>(false);
-
-export const useIsEnableUnifiedMergeView = (): boolean => {
-  return useAtomValue(isEnableUnifiedMergeViewAtom);
-};
-
-export const useUnifiedMergeViewActions = (): UnifiedMergeViewActions => {
-  const setIsEnabled = useSetAtom(isEnableUnifiedMergeViewAtom);
-
-  const enable = useCallback(() => {
-    setIsEnabled(true);
-  }, [setIsEnabled]);
-
-  const disable = useCallback(() => {
-    setIsEnabled(false);
-  }, [setIsEnabled]);
-
-  return { enable, disable };
-};
-```
-
-### 8️⃣ **Derived Atomパターン(高パフォーマンス)**
-```typescript
-// Derived atom(計算結果の自動メモ化・共有)
-const derivedCalculationAtom = atom((get) => {
-  const dependency1 = get(atom1);
-  const dependency2 = get(atom2);
-  
-  // undefined判定(必須)
-  if ([dependency1, dependency2].some(v => v === undefined)) {
-    return defaultValue;
-  }
-  
-  // 複雑な計算ロジック
-  return computeExpensiveCalculation(dependency1, dependency2);
-});
-
-// Public hook(シンプルな値取得のみ)
-export const useDerivedCalculation = () => {
-  return useAtomValue(derivedCalculationAtom);
-};
-```
-
-### 9️⃣ **複雑状態管理パターン(Map操作)**
-```typescript
-// Type definitions
-export type UpdateDescCountData = Map<string, number>;
-
-export type PageTreeDescCountMapGetter = {
-  getDescCount: (pageId?: string) => number | null;
-};
-
-export type PageTreeDescCountMapActions = {
-  update: (newData: UpdateDescCountData) => void;
-};
-
-// Atom definition
-const pageTreeDescCountMapAtom = atom<UpdateDescCountData>(new Map());
-
-// Read-only hook with getter function
-export const usePageTreeDescCountMap = (): PageTreeDescCountMapGetter => {
-  const data = useAtomValue(pageTreeDescCountMapAtom);
-
-  const getDescCount = useCallback(
-    (pageId?: string) => {
-      return pageId != null ? (data.get(pageId) ?? null) : null;
-    },
-    [data],
-  );
-
-  return { getDescCount };
-};
-
-// Actions hook (write-only with callbacks)
-export const usePageTreeDescCountMapAction = (): PageTreeDescCountMapActions => {
-  const setDescCountMap = useSetAtom(pageTreeDescCountMapAtom);
-
-  const update = useCallback(
-    (newData: UpdateDescCountData) => {
-      setDescCountMap((current) => {
-        return new Map([...current, ...newData]);
-      });
-    },
-    [setDescCountMap],
-  );
-
-  return { update };
-};
-```
-
-### 🔟 **副作用統合パターン(Router Integration)**
-```typescript
-// Internal atoms
-const commentEditorDirtyMapAtom = atom<CommentEditorDirtyMapData>(new Map());
-
-// Derived atom for computed state
-const isUnsavedWarningEnabledAtom = atom((get) => {
-  const dirtyMap = get(commentEditorDirtyMapAtom);
-  return dirtyMap.size > 0;
-});
-
-// Hook with side effects (Router integration)
-export const useUnsavedWarning = () => {
-  const router = useRouter();
-  const isEnabled = useAtomValue(isUnsavedWarningEnabledAtom);
-  const setDirtyMap = useSetAtom(commentEditorDirtyMapAtom);
-
-  const reset = useCallback(() => {
-    setDirtyMap(new Map());
-  }, [setDirtyMap]);
-
-  // Router event handling with cleanup
-  useLayoutEffect(() => {
-    router.events.on('routeChangeComplete', reset);
-    return () => {
-      router.events.off('routeChangeComplete', reset);
-    };
-  }, [reset, router.events]);
-
-  return { isEnabled, reset };
-};
-```
-
-## 📋 使用パターン早見表
-
-| パターン | 適用条件 | 使用例 |
-|---------|----------|--------|
-| フック分離 | モーダル等の複数操作 | `use[Modal]Status()`, `use[Modal]Actions()` |
-| デバイス状態 | MediaQuery監視 | `const [isLargerThanMd] = useDeviceLargerThanMd()` |
-| RefObject | DOM要素管理 | `const tocNode = useTocNode()`, `const setTocNode = useSetTocNode()` |
-| Dynamic Import | 重いライブラリ | `const { data, isLoading, error } = useTocOptions()` |
-| シンプルBoolean | 単純状態 | `const isUntitled = useIsUntitledPage()` |
-| server-configurations | サーバー設定 | `const data = useAtomValue(atomName)` |
-| 機能別states | 特定機能専用 | `const isEnabled = useIsEnableUnifiedMergeView()` |
-| Derived Atom | 高パフォーマンス計算 | `const result = useDerivedCalculation()` |
-| 複雑状態管理 | Map、Set等 | `const { getDescCount } = usePageTreeDescCountMap()` |
-| 副作用統合 | Router等の統合 | `const { isEnabled, reset } = useUnsavedWarning()` |
-
-## 🎯 技術ベストプラクティス
-
-### 重要原則
-- **後方互換フックは不要**: 移行完了後は即座に削除
-- **型の正しいインポート**: 元ファイルのimport文を参考にする
-- **フック分離のメリット**: 不要なリレンダリング防止、参照安定化
-- **特殊名Export**: `_atomsForDerivedAbilities`によるカプセル化維持
-- **計算結果共有**: 複数コンポーネント間での効率的な状態共有
-- **自動メモ化**: 依存atomが変わらない限り再計算されない
-
-### パフォーマンス最適化のポイント
-1. **自動メモ化**: 依存atomが変わらない限り再計算されない
-2. **計算結果共有**: 複数コンポーネント間で効率的に共有
-3. **最適化された更新**: Jotaiの依存関係追跡
-4. **undefined判定**: 初期化前の状態を適切にハンドリング
-5. **Callback最適化**: `useCallback`による関数参照安定化
-6. **副作用管理**: 適切なcleanup実装
-
-### 設計指針
-- **server-configurations**: wrapper hook不要、直接atom使用を推奨
-- **機能別states**: 特定機能専用(OpenAI等)のstatesディレクトリ分離
-- **既存atom優先**: 新規実装より既存atomの活用を優先
-- **不要コード削除**: deprecatedファイル・未使用フックの積極的削除
-- **複雑状態(Map, Set等)**: Getter/Actions分離パターン採用
-- **副作用統合**: 状態管理 + useEffect/useLayoutEffect組み合わせ

+ 0 - 204
.serena/memories/apps-app-jotai-migration-progress.md

@@ -1,204 +0,0 @@
-# GROWI Jotai移行 進捗レポート
-
-**最終更新日**: 2025-10-06  
-**更新者**: GitHub Copilot
-
----
-
-## 📊 全体進捗
-
-### 完了状況
-- **完了**: 62/63 フック (98.4%) ✅
-- **残り**: 1フック (`useSecondaryYdocs` - 別パッケージ管理)
-- **スコープ**: `apps/app/src/` 内の移行 **100% 完了** 🎉
-
-### 残りタスク
-
-#### useSecondaryYdocs
-- **ステータス**: 🔵 別パッケージ管理 (`packages/editor`)
-- **場所**: `packages/editor/src/client/stores/use-secondary-ydocs.ts`
-- **複雑度**: 高 - Y.Docライフサイクル管理
-- **注記**: `apps/app` の Jotai 移行対象外、別タスクで検討
-
----
-
-## ✅ 完了した移行
-
-### フェーズ1: モーダル状態(17個)
-
-#### 完了バッチ
-- ✅ **useEmptyTrashModal** - ゴミ箱空モーダル
-- ✅ **useDeleteAttachmentModal** - 添付ファイル削除
-- ✅ **useDeleteBookmarkFolderModal** - ブックマークフォルダ削除
-- ✅ **useUpdateUserGroupConfirmModal** - ユーザーグループ更新確認
-- ✅ **usePageSelectModal** - ページ選択
-- ✅ **usePagePresentationModal** - プレゼンテーション
-- ✅ **usePutBackPageModal** - ページ復元
-- ✅ **useGrantedGroupsInheritanceSelectModal** - 権限グループ継承選択
-- ✅ **useDrawioModal** - Draw.io
-- ✅ **useHandsontableModal** - Handsontable
-- ✅ **usePrivateLegacyPagesMigrationModal** - プライベートレガシーページ移行
-- ✅ **useDescendantsPageListModal** - 子孫ページリスト
-- ✅ **useConflictDiffModal** - 競合差分
-- ✅ **usePageBulkExportSelectModal** - ページ一括エクスポート選択
-- ✅ **useDrawioModalForEditor** - エディタ用Draw.io
-- ✅ **useLinkEditModal** - リンク編集
-- ✅ **useTemplateModal** - テンプレート
-
-**パターン**: Status/Actions分離による最適化
-**削除**: `stores/modal.tsx` 完全削除
-
-### フェーズ2: デバイス・UI状態(7個)
-
-#### デバイス幅判定
-- ✅ **useIsDeviceLargerThanMd** - MD以上判定(8ファイル更新)
-- ✅ **useIsDeviceLargerThanLg** - LG以上判定(3ファイル更新)
-- ✅ **useIsMobile** - モバイル判定(1ファイル更新)
-
-#### TOC関連
-- ✅ **useTocNode** / **useSetTocNode** - RefObjectパターン
-- ✅ **useTocOptions** - Dynamic Import + Caching
-- ✅ **useTocOptionsReady** - 準備完了判定
-
-**特徴**: 
-- MediaQuery監視による動的更新
-- Bundle Splitting(renderer.tsx遅延ロード)
-- SWRからJotai完全移行(50%コード削減)
-
-#### 無題ページ状態
-- ✅ **useIsUntitledPage** / **useSetIsUntitledPage**
-
-**パターン**: シンプルなboolean atomとsetter
-**削除**: `stores/ui.tsx` 完全削除
-
-### フェーズ3: 複雑な状態管理(5個)
-
-#### 1. useIsSlackEnabled
-- **場所**: `states/ui/editor/is-slack-enabled.ts`
-- **パターン**: シンプルboolean
-- **更新**: 3ファイル
-
-#### 2. useReservedNextCaretLine
-- **場所**: `states/ui/editor/reserved-next-caret-line.ts`
-- **パターン**: globalEmitter統合
-- **更新**: 3ファイル
-
-#### 3. useAiAssistantSidebar
-- **場所**: `features/openai/client/states/ai-assistant-sidebar.ts`
-- **パターン**: Status/Actions分離
-- **更新**: 11ファイル
-- **削除**: `features/openai/client/stores/ai-assistant.tsx`
-
-#### 4. useKeywordManager ⭐
-- **場所**: `states/search/keyword-manager.ts`
-- **パターン**: 3フック分離(読み取り/副作用/書き込み)
-- **特徴**: URL同期、Router統合、cleanup関数
-- **更新**: 7ファイル
-- **非推奨化**: `client/services/search-operation.ts`
-
-#### 5. useCurrentPageYjsData ⭐ リファクタリング済
-- **場所**: `features/collaborative-editor/states/current-page-yjs-data.ts`
-- **パターン**: 3つの独立したatom(data/loading/error)
-- **特徴**: 
-  - 細かい粒度での再レンダリング制御
-  - WebSocket統合
-  - 純粋なJotai実装(SWR不使用)
-- **更新**: 8ファイル
-- **フック**:
-  - `useCurrentPageYjsData()` - データ取得
-  - `useCurrentPageYjsDataLoading()` - ロード状態
-  - `useCurrentPageYjsDataError()` - エラー状態
-  - `useCurrentPageYjsDataActions()` - 更新/フェッチアクション
-
----
-
-## 📋 採用した技術パターン
-
-### 1. Status/Actions分離パターン ⭐
-- **適用**: モーダル、複雑な状態
-- **メリット**: 最適な再レンダリング、責務分離
-
-### 2. 3フック分離パターン ⭐
-- **適用**: URL同期などの副作用を持つ状態
-- **メリット**: 超最適な再レンダリング、副作用の単一責任点
-
-### 3. 独立Atomパターン ⭐ NEW
-- **適用**: data/loading/errorなど複数の状態
-- **メリット**: 細かい粒度での再レンダリング制御、シンプルな実装
-
-### 4. globalEmitter統合パターン
-- **適用**: レガシーイベントシステム統合
-- **実装**: useEffect + cleanup
-
-### 5. Router統合パターン
-- **適用**: URL/ブラウザ履歴同期
-- **実装**: beforePopState + cleanup
-
-### 6. RefObjectパターン
-- **適用**: DOM要素管理
-- **メリット**: 型安全なDOM参照
-
-### 7. Dynamic Import + Cachingパターン
-- **適用**: 重いライブラリの遅延ロード
-- **メリット**: Bundle Splitting、初期ロード高速化
-
-### 8. シンプルBooleanパターン
-- **適用**: 単純なフラグ状態
-- **実装**: `useAtomValue` + `useSetAtom`
-
----
-
-## 🎉 達成事項
-
-### 移行実績
-- ✅ 62/63 フック移行完了 (98.4%)
-- ✅ 5バッチで62ファイル更新
-- ✅ 5つの旧実装ファイル完全削除
-- ✅ 全ての型チェック通過
-
-### アーキテクチャ改善
-- ✅ 8つの技術パターン確立
-- ✅ states/とstores/の責務分離明確化
-- ✅ メモリリーク防止(cleanup関数)
-- ✅ パフォーマンス最適化(細かい粒度の再レンダリング制御)
-
-### コードベース改善
-- ✅ 不適切なSWR使用の排除(useSWRStatic、useSWRImmutable)
-- ✅ deprecated API完全削除
-- ✅ 責務の明確化(状態管理 vs 通信)
-
----
-
-## 📝 アーキテクチャ原則
-
-### ディレクトリ構造
-- **states/** - Jotai atom(純粋なクライアント状態管理)
-- **stores/** - SWR統合(サーバー非同期通信)
-- **features/[feature]/states/** - 機能固有の状態
-
-### 命名規則
-- 読み取り専用: `use[Feature]()`
-- 書き込み専用: `useSet[Feature]()`、`use[Feature]Actions()`
-- 副作用専用: `use[Feature]Manager()`
-- 状態取得: `use[Feature]Loading()`、`use[Feature]Error()`
-
----
-
-## 🚀 次のステップ
-
-### 完了事項
-1. ✅ `apps/app` 内の Jotai 移行完了
-
-### 今後の展開(オプション)
-1. 全移行済みフックの包括的なテスト
-2. パフォーマンスベンチマーク
-3. ✅ **`packages/editor` への Jotai 導入検討完了** → 詳細は `packages-editor-jotai-migration-plan.md` 参照
-4. ✅ **`useSWRStatic/useStaticSWR` 廃止計画策定完了** → 詳細は `useSWRStatic-deprecation-plan.md` 参照
-5. 🔄 **`useSWRStatic/useStaticSWR` 廃止進行中** → 進捗は `useSWRStatic-deprecation-progress.md` 参照
-   - ✅ Phase 1-1 完了: useIsMaintenanceMode (1/7 箇所)
-   - ⏳ Phase 1-2 次: useGlobalAdminSocket
-6. 他パッケージへの展開検討
-
----
-
-**注記**: `apps/app/src/stores/` と `apps/app/src/states/` の移行は100%完了。

+ 0 - 361
.serena/memories/packages-editor-jotai-migration-plan.md

@@ -1,361 +0,0 @@
-# packages/editor への Jotai 導入検討レポート
-
-**作成日**: 2025-10-06  
-**作成者**: GitHub Copilot  
-**関連**: `apps-app-jotai-migration-progress.md`
-
----
-
-## 📊 現状分析
-
-### ✅ 既存のJotai実装
-`packages/editor`には**すでにJotaiが導入されており**、一部で活用されています:
-
-#### 既存のJotai States
-```
-packages/editor/src/states/
-├── modal/
-│   ├── link-edit.ts          ✅ Jotai (Status/Actions分離)
-│   ├── template.ts           ✅ Jotai (Status/Actions分離)
-│   ├── drawio-for-editor.ts  ✅ Jotai (Status/Actions分離)
-│   └── handsontable.ts       ✅ Jotai (Status/Actions分離)
-└── ui/
-    └── resolved-theme.ts      ✅ Jotai (シンプルパターン)
-```
-
-**特徴**:
-- `apps/app`と同じアーキテクチャパターンを採用
-- Status/Actions分離パターン(モーダル)
-- シンプルなatom + getter/setter(テーマ)
-- 命名規則も統一されている
-
-### 🔴 SWR/useState依存の実装
-`packages/editor/src/client/stores/` には未移行のフックが存在:
-
-#### 1. **useCodeMirrorEditorIsolated** (codemirror-editor.ts)
-- **現状**: `useSWRStatic` + `useRef`
-- **使用箇所**: 20箇所以上(コンポーネント全体に浸透)
-- **役割**: CodeMirrorインスタンスの分離された管理
-- **複雑度**: 🟡 中 - deepEqualsによる更新判定
-
-#### 2. **useSecondaryYdocs** (use-secondary-ydocs.ts)
-- **現状**: `useSWRImmutable` + Y.Doc管理
-- **使用箇所**: 2箇所(use-collaborative-editor-mode、use-unified-merge-view)
-- **役割**: Collaborative Editingのための Primary/Secondary Y.Doc管理
-- **複雑度**: 🔴 高 - Y.Docライフサイクル、メモリ管理
-
-#### 3. **useCollaborativeEditorMode** (use-collaborative-editor-mode.ts)
-- **現状**: `useState` + `useEffect` + SocketIOProvider
-- **使用箇所**: 調査必要
-- **役割**: リアルタイム共同編集モードの管理
-- **複雑度**: 🔴 高 - WebSocket、Y.Doc、SocketIOProvider統合
-- **依存**: `useSecondaryYdocs`に依存
-
-#### 4. **useEditorSettings** (use-editor-settings.ts)
-- **現状**: `useState` + 複数の`useEffect`
-- **使用箇所**: 調査必要
-- **役割**: エディタ設定(テーマ、キーマップ、スタイル等)の管理
-- **複雑度**: 🟡 中 - 複数の拡張機能の動的ロード
-
-#### 5. **useEditorShortcuts** (use-editor-shortcuts.ts)
-- **現状**: `useEffect` - コマンド登録のみ
-- **使用箇所**: useEditorSettingsから使用
-- **役割**: エディタショートカットキーの登録
-- **複雑度**: 🟢 低 - 副作用のみ
-
-#### 6. **useDefaultExtensions** (use-default-extensions.ts)
-- **現状**: 未確認(調査必要)
-- **使用箇所**: 調査必要
-- **役割**: デフォルトCodeMirror拡張機能
-- **複雑度**: 調査必要
-
----
-
-## 🎯 移行優先度評価(調査完了版)
-
-### 移行対象フック一覧
-| フック名 | 現状 | 使用箇所 | 複雑度 | 優先度 | 推奨 |
-|---------|------|---------|--------|--------|------|
-| useCodeMirrorEditorIsolated | useSWRStatic | 20+ | 🟡 中 | 🟡 中 | 段階的移行検討 |
-| useEditorSettings | useState | 2 | 🟡 中 | 🟡 中 | 移行検討可能 |
-| useCollaborativeEditorMode | useState | 1 | 🔴 高 | 🟡 中 | 移行検討可能 |
-| useSecondaryYdocs | useSWRImmutable | 2 | 🔴 高 | 🔵 低 | **現状維持** |
-| useEditorShortcuts | useEffect | 1 | 🟢 低 | ❌ なし | **現状維持** |
-| useDefaultExtensions | useEffect | 2 | 🟢 低 | ❌ なし | **現状維持** |
-
----
-
-### 🔵 優先度:低(当面移行不要)
-
-#### **useSecondaryYdocs**
-**理由**:
-1. **高い複雑度**: Y.Docライフサイクル管理、メモリ管理
-2. **SWRの適切な使用**: キャッシュとライフサイクル管理に適している
-3. **限定的な使用**: 2箇所のみ、影響範囲小
-4. **安定性**: 既存実装が安定稼働中
-5. **Jotai化のメリット小**: キャッシュ機能がSWRで適切に実現されている
-
-**現状維持を推奨**: SWRの特性(キャッシュ、Immutable)が適している
-
-**使用箇所**:
-- `use-collaborative-editor-mode.ts`
-- `use-unified-merge-view.ts`
-
----
-
-### 🟡 優先度:中(移行検討可能)
-
-#### 1. **useCodeMirrorEditorIsolated** ⭐
-**移行メリット**:
-- 20箇所以上の使用箇所でパフォーマンス改善
-- `useSWRStatic`の不適切な使用を排除
-- `apps/app`の他の状態と統合しやすくなる
-- 最も影響範囲が大きく、改善効果も大きい
-
-**移行課題**:
-- 使用箇所が多く、段階的移行が必要
-- CodeMirrorインスタンスの分離管理ロジックの再設計
-- deepEqualsベースの更新判定の再実装
-
-**使用箇所**: 20+ 箇所
-- Playground系: 3箇所
-- Toolbar系: 9箇所
-- Component系: 4箇所
-- Controller系: 4箇所
-
-**推奨アプローチ**:
-```typescript
-// 新実装案
-// packages/editor/src/states/codemirror-editor.ts
-
-type CodeMirrorEditorData = Map<string, UseCodeMirrorEditor>;
-
-const codeMirrorEditorMapAtom = atom<CodeMirrorEditorData>(new Map());
-
-// Derived atom for specific editor
-const createEditorAtom = (key: string) => {
-  return atom((get) => {
-    const map = get(codeMirrorEditorMapAtom);
-    return map.get(key) ?? null;
-  });
-};
-
-// Hook pattern
-export const useCodeMirrorEditor = (key: string | null) => {
-  const setEditorMap = useSetAtom(codeMirrorEditorMapAtom);
-  // ... implementation
-};
-```
-
-#### 2. **useEditorSettings**
-**移行メリット**:
-- 複数のuseStateを統合してシンプルに
-- 拡張機能の動的ロード状態を明確に管理
-- 再レンダリング最適化
-- コードの可読性向上
-
-**移行課題**:
-- 複数の拡張機能(theme、keymap等)の状態管理
-- 動的import + キャッシングパターンの適用
-- useEditorShortcutsとの統合検討
-
-**使用箇所**: 2箇所
-- `CodeMirrorEditor.tsx`
-- `CodeMirrorEditorDiff.tsx`
-
-**推奨アプローチ**:
-```typescript
-// packages/editor/src/states/editor-settings.ts
-
-type EditorSettingsState = {
-  styleActiveLine?: boolean;
-  autoFormatMarkdownTable?: boolean;
-  theme?: EditorTheme;
-  keymapMode?: KeyMapMode;
-};
-
-const editorSettingsAtom = atom<EditorSettingsState>({});
-
-// Individual derived atoms for each extension
-const themeExtensionAtom = atom(async (get) => {
-  const theme = get(editorSettingsAtom).theme;
-  return theme ? await getEditorTheme(theme) : undefined;
-});
-```
-
-#### 3. **useCollaborativeEditorMode**
-**移行メリット**:
-- WebSocket状態の明確な管理
-- 複数のuseEffectをクリーンに整理
-- 共同編集状態の可視化向上
-
-**移行課題**:
-- SocketIOProvider統合の複雑性
-- useSecondaryYdocsへの依存(これはSWR維持推奨)
-- WebSocketライフサイクル管理
-- リアルタイム通信の状態管理
-
-**使用箇所**: 1箇所のみ
-- `CodeMirrorEditorMain.tsx`
-
-**推奨**: `useSecondaryYdocs`との統合を考慮した設計が必要。  
-影響範囲は小さいが、実装の複雑度は高い。
-
----
-
-### 🟢 移行不要(現状維持推奨)
-
-#### 1. **useEditorShortcuts**
-**理由**:
-- 状態を持たず、副作用のみ
-- Jotai化してもしなくても影響は限定的
-- カスタムフックのまま維持でも問題なし
-
-**推奨**: 現状維持でOK(Jotai化の優先度低)
-
-#### 2. **useDefaultExtensions**
-**理由**:
-- 状態を持たず、静的なExtension配列の適用のみ
-- 使用箇所も2箇所のみ
-- Jotai化する意味がない
-
-**推奨**: 現状維持でOK(Jotai化不要)
-
----
-
-## 📋 推奨移行戦略
-
-### フェーズ1: 基盤整備(優先度:低)
-1. ✅ 既存Jotai States(modal、ui)は完成済み
-2. 📝 `packages/editor`固有のJotaiパターンドキュメント化
-3. 📝 `apps/app`との統合ガイドライン策定
-
-### フェーズ2: 段階的移行(優先度:中)
-**実施条件**: リソースに余裕がある場合のみ
-
-#### 推奨移行順序と工数見積もり
-
-##### ステップ1: useEditorSettings(推定工数:2-3日)
-- ✅ **影響範囲**: 小(2箇所のみ)
-- ✅ **複雑度**: 中
-- ✅ **リスク**: 低
-- **作業内容**:
-  - 複数のuseStateをJotai atomに統合
-  - Dynamic Import + Cachingパターン適用
-  - theme/keymap extensionの状態管理をatomに移行
-- **期待効果**: コード整理、可読性向上
-
-##### ステップ2: useCollaborativeEditorMode(推定工数:3-5日)
-- ✅ **影響範囲**: 小(1箇所のみ)
-- 🟡 **複雑度**: 高
-- 🟡 **リスク**: 中
-- **作業内容**:
-  - WebSocket/SocketIOProvider状態のatom化
-  - useSecondaryYdocs(SWR維持)との統合設計
-  - リアルタイム編集状態の管理改善
-- **期待効果**: 状態管理の明確化、デバッグ容易性向上
-
-##### ステップ3: useCodeMirrorEditorIsolated(推定工数:5-7日)⭐
-- 🔴 **影響範囲**: 大(20+箇所)
-- 🟡 **複雑度**: 中
-- 🔴 **リスク**: 中~高
-- **作業内容**:
-  - Map<string, UseCodeMirrorEditor>パターンでの実装
-  - 段階的移行(後方互換フック提供)
-  - 全使用箇所の更新(20+箇所)
-  - 十分なテスト実施
-- **期待効果**: パフォーマンス改善(最大)、useSWRStatic排除
-
-**総工数見積もり**: 10-15日(フルタイム換算)
-
-### フェーズ3: 維持(継続)
-- **useSecondaryYdocs**: SWR維持(移行不要)
-- **useEditorShortcuts**: 現状維持(移行不要)
-
----
-
-## ✅ 追加調査完了
-
-### 1. **useDefaultExtensions** ✅
-- **実装**: 静的なExtension配列をappendExtensionsするだけ
-- **状態**: なし(副作用のみ)
-- **使用箇所**: 2箇所(CodeMirrorEditor.tsx、CodeMirrorEditorDiff.tsx)
-- **複雑度**: 🟢 最低 - 設定適用のみ
-- **Jotai化の必要性**: ❌ なし(状態を持たないため)
-- **推奨**: 現状維持
-
-### 2. **useCodeMirrorEditorIsolated** ✅
-- **使用箇所**: 20箇所以上
-  - Playground.tsx (2箇所)
-  - CodeMirrorEditor.tsx (1箇所)
-  - controller/* (4箇所)
-  - Toolbar/* (9箇所)
-  - CodeMirrorEditorMain.tsx (1箇所)
-  - その他
-- **影響範囲**: 🔴 大 - パッケージ全体に浸透
-- **段階的移行**: 必須
-
-### 3. **useCollaborativeEditorMode** ✅
-- **使用箇所**: 1箇所のみ(CodeMirrorEditorMain.tsx)
-- **影響範囲**: 🟢 小 - 限定的
-- **依存**: useSecondaryYdocs(SWR維持推奨)
-- **移行容易性**: 🟡 中 - 依存関係はシンプルだが、実装は複雑
-
-### 4. **useEditorSettings** ✅
-- **使用箇所**: 2箇所(CodeMirrorEditor.tsx、CodeMirrorEditorDiff.tsx)
-- **影響範囲**: 🟢 小 - 限定的
-- **移行容易性**: 🟡 中 - 複数のuseStateとuseEffectを整理
-- **移行メリット**: 🟡 中 - コード整理とパフォーマンス改善
-
-### 5. `packages/editor` ⇔ `apps/app` 連携 ✅
-- **独立パッケージ**: `packages/editor`は独立したパッケージ
-- **状態の分離**: `apps/app/src/states` と `packages/editor/src/states` は完全に分離
-- **影響**: 移行は独立して実施可能、相互影響なし
-
----
-
-## 🎯 結論と推奨事項
-
-### 即座の移行は不要
-- 既存のJotai実装(modal、ui)は完成しており、パターンも確立
-- `stores/`配下のフックは複雑度が高く、SWRが適切に機能している箇所もある
-
-### 段階的アプローチを推奨
-1. **短期**: 現状維持、既存Jotai Statesの活用拡大
-2. **中期**: useEditorSettings → useCodeMirrorEditorIsolated の順で移行検討
-3. **長期**: useCollaborativeEditorModeの移行検討(useSecondaryYdocsはSWR維持)
-
-### 移行判断の基準
-- **パフォーマンス改善**: 再レンダリング最適化の効果が大きい
-- **コード品質**: useSWRStatic等の不適切な使用を排除
-- **保守性向上**: 状態管理の統一によるコードベースの一貫性
-- **リソース**: 十分な開発リソースと検証期間の確保
-
-### `apps/app` との関係
-- `apps/app`のJotai移行は100%完了
-- `packages/editor`は独立パッケージとして段階的に移行可能
-- 両者のstatesディレクトリは明確に分離されており、影響は限定的
-
----
-
-## 📚 参考情報
-
-### 関連ドキュメント
-- `apps-app-jotai-migration-progress.md` - apps/app移行完了レポート
-- `apps-app-jotai-migration-guidelines.md` - 技術パターン・ベストプラクティス
-- `apps-app-jotai-directory-structure.md` - ディレクトリ構造・命名規則
-- `useSWRStatic-deprecation-plan.md` - useSWRStatic/useStaticSWR 廃止計画 ⭐ NEW
-
-### 技術パターンの適用可能性
-- ✅ Status/Actions分離パターン → 既に適用済み(modal)
-- ✅ シンプルBooleanパターン → 既に適用済み(resolved-theme)
-- 🟡 Dynamic Import + Cachingパターン → useEditorSettings に適用可能
-- 🟡 Map操作パターン → useCodeMirrorEditorIsolated に適用可能
-- 🔴 副作用統合パターン → useCollaborativeEditorMode に適用可能(高難度)
-
----
-
-**結論**: `packages/editor`へのJotai導入は段階的に進めることを推奨。  
-現時点では、既存のJotai実装(modal、ui)が安定しており、  
-`stores/`配下の複雑なフックは**無理に移行する必要はない**。  
-リソースと優先度に応じて、中期的に移行を検討する。

+ 0 - 382
.serena/memories/useSWRStatic-deprecation-plan.md

@@ -1,382 +0,0 @@
-# useSWRStatic / useStaticSWR 廃止計画
-
-**作成日**: 2025-10-06  
-**作成者**: GitHub Copilot  
-**目標**: `useSWRStatic`と`useStaticSWR`を完全廃止する
-
----
-
-## 📊 現状分析
-
-### useSWRStatic / useStaticSWR の使用箇所
-
-#### 🔴 apps/app での使用(要対応:4箇所)
-
-##### 1. **stores/maintenanceMode.tsx** - `useIsMaintenanceMode`
-- **現状**: `useStaticSWR` を使用
-- **状況**: ⚠️ **重複実装が存在** - `states/global/global.ts` にも `isMaintenanceModeAtom` が存在
-- **使用箇所**: 調査必要
-- **移行方法**: 既存の `states/global/global.ts` の atom を活用
-- **優先度**: 🔴 **高** - 重複コード削除
-
-##### 2. **stores/personal-settings.tsx** - `usePersonalSettings`
-- **現状**: `useStaticSWR` を使用(DB同期用の中間キャッシュ)
-- **使用箇所**: 12箇所(Me設定画面、DrawioModal、TemplateModal等)
-- **役割**: `/personal-setting` API から取得したユーザー情報のキャッシュ管理
-- **複雑度**: 🟡 中 - sync/update機能を含む
-- **移行方法**: Jotai atom化 + `useSWRxPersonalSettings`との統合
-- **優先度**: 🟡 **中**
-
-##### 3. **stores/websocket.tsx** - `useGlobalAdminSocket`
-- **現状**: `useSWRStatic` を使用(WebSocket管理)
-- **使用箇所**: 1箇所(Admin/V5PageMigration.tsx)
-- **役割**: Global Admin Socket の管理
-- **複雑度**: 🟢 低
-- **移行方法**: Jotai atom化(socket.io client state)
-- **優先度**: 🟢 **低**
-
-##### 4. **stores-universal/use-context-swr.tsx** - `useContextSWR`
-- **現状**: `useSWRStatic` を使用
-- **使用箇所**: 使用箇所なし(internal definition only)
-- **役割**: Context用の SWR wrapper(mutate禁止)
-- **複雑度**: 🟢 低
-- **移行方法**: 使用箇所がないため削除可能
-- **優先度**: 🟢 **低** - 使用箇所がない
-
-##### 5. **stores/use-static-swr.ts**
-- **現状**: `@deprecated` - `useSWRStatic` の再エクスポート
-- **移行方法**: 上記1-4の移行完了後に削除
-- **優先度**: ⭐ **最終削除対象**
-
----
-
-#### 🔴 packages/editor での使用(要対応:2箇所)
-
-##### 1. **stores/codemirror-editor.ts** - `useCodeMirrorEditorIsolated`
-- **現状**: `useSWRStatic` + `useRef`
-- **使用箇所**: 20+箇所(パッケージ全体に浸透)
-- **役割**: CodeMirrorインスタンスの分離管理
-- **複雑度**: 🟡 中
-- **移行方法**: Map<string, UseCodeMirrorEditor> パターンで Jotai 化
-- **優先度**: 🔴 **最高** - 影響範囲が最大
-- **詳細**: `packages-editor-jotai-migration-plan.md` 参照
-
-##### 2. **components-internal/playground/Playground.tsx**
-- **現状**: `useSWRStatic(GLOBAL_SOCKET_KEY)` - mutate のみ使用
-- **使用箇所**: 1箇所(Playgroundのみ)
-- **役割**: Global Socket の mutate
-- **複雑度**: 🟢 低
-- **移行方法**: Jotai atom化またはprops経由
-- **優先度**: 🟢 **低** - Playground専用
-
----
-
-#### 🟢 packages/core での定義(変更不要)
-
-##### packages/core/src/swr/use-swr-static.ts
-- **役割**: `useSWRStatic` の実装定義
-- **依存**: 
-  - `packages/core/src/swr/use-global-socket.ts` → Jotai化必要
-- **移行方法**: apps/app と packages/editor の移行完了後に削除を検討
-
----
-
-## 🎯 廃止計画
-
-### フェーズ1: apps/app の移行(優先度:高)
-
-#### ステップ1-1: useIsMaintenanceMode 重複解消(推定工数:0.5日)⭐
-**優先度:最高 - 重複コード削除**
-
-**現状**:
-- `stores/maintenanceMode.tsx` - `useStaticSWR` 使用
-- `states/global/global.ts` - `isMaintenanceModeAtom` 既存(Jotai)
-
-**問題**: 同じ状態を2箇所で管理している
-
-**移行手順**:
-1. `stores/maintenanceMode.tsx` の使用箇所を調査
-2. `states/global/global.ts` に actions を追加
-3. 使用箇所を新しい実装に置き換え
-4. `stores/maintenanceMode.tsx` を削除
-
-**新実装案**:
-```typescript
-// states/global/global.ts に追加
-
-const isMaintenanceModeAtom = atom<boolean>(false); // 既存
-
-export const useIsMaintenanceMode = () => useAtomValue(isMaintenanceModeAtom); // 既存
-
-// Actions を追加
-export const useMaintenanceModeActions = () => {
-  const setIsMaintenanceMode = useSetAtom(isMaintenanceModeAtom);
-
-  const start = useCallback(async () => {
-    await apiv3Post('/app-settings/maintenance-mode', { flag: true });
-    setIsMaintenanceMode(true);
-  }, [setIsMaintenanceMode]);
-
-  const end = useCallback(async () => {
-    await apiv3Post('/app-settings/maintenance-mode', { flag: false });
-    setIsMaintenanceMode(false);
-  }, [setIsMaintenanceMode]);
-
-  return { start, end };
-};
-```
-
-**期待効果**: 
-- 重複コード削除
-- Jotai統一による保守性向上
-- useSWRStatic使用箇所 -1
-
----
-
-#### ステップ1-2: usePersonalSettings のJotai化(推定工数:2-3日)
-
-**移行手順**:
-1. `states/user/` ディレクトリ作成
-2. Personal Settings 用の atom + actions 実装
-3. `useSWRxPersonalSettings`(SWR)との連携設計
-4. 12箇所の使用箇所を段階的に移行
-5. `stores/personal-settings.tsx` 削除
-
-**新実装案**:
-```typescript
-// states/user/personal-settings.ts
-
-type PersonalSettingsData = IUser;
-
-const personalSettingsAtom = atom<PersonalSettingsData | undefined>(undefined);
-
-// Read-only hook
-export const usePersonalSettings = () => {
-  return useAtomValue(personalSettingsAtom);
-};
-
-// Actions hook
-export const usePersonalSettingsActions = () => {
-  const setPersonalSettings = useSetAtom(personalSettingsAtom);
-  const { mutate: revalidateDB } = useSWRxPersonalSettings();
-
-  const sync = useCallback(async () => {
-    const result = await revalidateDB();
-    setPersonalSettings(result);
-  }, [setPersonalSettings, revalidateDB]);
-
-  const updateBasicInfo = useCallback(async () => {
-    // ... implementation
-  }, [setPersonalSettings]);
-
-  // ... other actions
-
-  return { sync, updateBasicInfo, /* ... */ };
-};
-```
-
-**期待効果**:
-- SWR(DB通信)とJotai(クライアント状態)の責務分離
-- useSWRStatic使用箇所 -1
-
----
-
-#### ステップ1-3: useGlobalAdminSocket のJotai化(推定工数:0.5日)
-
-**移行手順**:
-1. `states/socket-io/admin-socket.ts` 作成
-2. Admin Socket 用の atom 実装
-3. 1箇所の使用箇所を更新
-4. `stores/websocket.tsx` 削除
-
-**新実装案**:
-```typescript
-// states/socket-io/admin-socket.ts
-
-import type { Socket } from 'socket.io-client';
-
-const globalAdminSocketAtom = atom<Socket | undefined>(undefined);
-
-export const useGlobalAdminSocket = () => {
-  return useAtomValue(globalAdminSocketAtom);
-};
-
-export const useSetGlobalAdminSocket = () => {
-  return useSetAtom(globalAdminSocketAtom);
-};
-```
-
-**期待効果**:
-- Socket管理の Jotai 統一
-- useSWRStatic使用箇所 -1
-
----
-
-#### ステップ1-4: useContextSWR 削除(推定工数:0.1日)
-
-**移行手順**:
-1. 使用箇所がないことを確認
-2. `stores-universal/use-context-swr.tsx` 削除
-
-**期待効果**:
-- 不要コード削除
-- useSWRStatic使用箇所 -1
-
----
-
-#### ステップ1-5: use-static-swr.ts 削除(推定工数:0.1日)
-
-**移行手順**:
-1. 上記4ステップ完了後
-2. `stores/use-static-swr.ts` 削除
-
-**期待効果**:
-- deprecated ファイル削除
-- `apps/app` での useSWRStatic 完全廃止 ✅
-
-**apps/app 完了**: useSWRStatic 使用箇所 0 🎉
-
----
-
-### フェーズ2: packages/editor の移行(優先度:中)
-
-#### ステップ2-1: useCodeMirrorEditorIsolated のJotai化(推定工数:5-7日)⭐
-
-**詳細**: `packages-editor-jotai-migration-plan.md` 参照
-
-**移行手順**:
-1. `states/codemirror-editor.ts` 作成
-2. Map<string, UseCodeMirrorEditor> パターンで実装
-3. 20+箇所を段階的に移行(後方互換フック提供)
-4. `stores/codemirror-editor.ts` 削除
-
-**期待効果**:
-- パフォーマンス改善(最大)
-- useSWRStatic使用箇所 -1
-
----
-
-#### ステップ2-2: Playground の useSWRStatic 削除(推定工数:0.5日)
-
-**移行手順**:
-1. Global Socket を Jotai atom化(apps/app と統合)
-2. Playground での使用を Jotai hook に置き換え
-3. useSWRStatic import 削除
-
-**期待効果**:
-- useSWRStatic使用箇所 -1
-- `packages/editor` での useSWRStatic 完全廃止 ✅
-
-**packages/editor 完了**: useSWRStatic 使用箇所 0 🎉
-
----
-
-### フェーズ3: packages/core の整理(優先度:低)
-
-#### ステップ3-1: use-global-socket.ts の更新(推定工数:0.5日)
-
-**現状**: `useSWRStatic` に依存
-
-**移行手順**:
-1. apps/app での Global Socket の Jotai 実装を確認
-2. `packages/core/src/swr/use-global-socket.ts` を更新または削除を検討
-
----
-
-#### ステップ3-2: use-swr-static.ts の削除検討(推定工数:TBD)
-
-**現状**: `useSWRStatic` の実装
-
-**移行条件**: 
-- apps/app での使用箇所 0 ✅
-- packages/editor での使用箇所 0 ✅
-- 他パッケージでの使用箇所調査
-
-**移行手順**:
-1. 全パッケージでの使用箇所を調査
-2. 使用箇所がなければ削除
-3. ある場合は個別に Jotai 化を検討
-
----
-
-## 📊 総合工数見積もり
-
-### フェーズ1: apps/app(必須)
-| ステップ | 工数 | 優先度 | 廃止数 |
-|---------|------|--------|--------|
-| 1-1. useIsMaintenanceMode | 0.5日 | 🔴 最高 | -1 |
-| 1-2. usePersonalSettings | 2-3日 | 🟡 中 | -1 |
-| 1-3. useGlobalAdminSocket | 0.5日 | 🟢 低 | -1 |
-| 1-4. useContextSWR | 0.1日 | 🟢 低 | -1 |
-| 1-5. use-static-swr.ts | 0.1日 | ⭐ 最終 | -1 |
-| **小計** | **3-4日** | | **-5箇所** |
-
-### フェーズ2: packages/editor(推奨)
-| ステップ | 工数 | 優先度 | 廃止数 |
-|---------|------|--------|--------|
-| 2-1. useCodeMirrorEditorIsolated | 5-7日 | 🔴 高 | -1 |
-| 2-2. Playground | 0.5日 | 🟢 低 | -1 |
-| **小計** | **5.5-7.5日** | | **-2箇所** |
-
-### フェーズ3: packages/core(オプション)
-| ステップ | 工数 | 優先度 | 廃止数 |
-|---------|------|--------|--------|
-| 3-1. use-global-socket.ts | 0.5日 | 🟢 低 | 調査次第 |
-| 3-2. use-swr-static.ts | TBD | 🟢 低 | 調査次第 |
-| **小計** | **TBD** | | **TBD** |
-
----
-
-## 🎯 推奨実施順序
-
-### 即座に実施すべき(最優先)
-1. ✅ **ステップ1-1: useIsMaintenanceMode 重複解消** (0.5日)
-   - 重複コード削除
-   - 最も簡単で効果が大きい
-
-### 短期で実施(1-2週間)
-2. ✅ **ステップ1-2: usePersonalSettings** (2-3日)
-3. ✅ **ステップ1-3: useGlobalAdminSocket** (0.5日)
-4. ✅ **ステップ1-4: useContextSWR** (0.1日)
-5. ✅ **ステップ1-5: use-static-swr.ts** (0.1日)
-
-**完了時**: `apps/app` での useSWRStatic 完全廃止 🎉
-
-### 中期で実施(1-2ヶ月)
-6. ✅ **ステップ2-1: useCodeMirrorEditorIsolated** (5-7日)
-7. ✅ **ステップ2-2: Playground** (0.5日)
-
-**完了時**: `packages/editor` での useSWRStatic 完全廃止 🎉
-
-### 長期で検討(3ヶ月+)
-8. ⭐ **フェーズ3: packages/core の整理**
-
----
-
-## 🎉 最終目標
-
-### 完全廃止達成条件
-- ✅ `apps/app` での useSWRStatic/useStaticSWR 使用箇所: **0**
-- ✅ `packages/editor` での useSWRStatic 使用箇所: **0**
-- ✅ `apps/app/src/stores/use-static-swr.ts` 削除
-- ⭐ `packages/core/src/swr/use-swr-static.ts` 削除検討
-
-### 期待効果
-- 🎯 **アーキテクチャ統一**: SWR(通信)とJotai(状態)の明確な分離
-- 🎯 **保守性向上**: 重複コード削除、責務の明確化
-- 🎯 **パフォーマンス改善**: 不適切なSWR使用の排除
-- 🎯 **コードベース品質**: 技術的負債の解消
-
----
-
-## 📚 関連ドキュメント
-
-- `apps-app-jotai-migration-progress.md` - apps/app Jotai移行完了レポート
-- `apps-app-jotai-migration-guidelines.md` - 技術パターン
-- `packages-editor-jotai-migration-plan.md` - packages/editor 移行計画
-
----
-
-**結論**: useSWRStatic/useStaticSWR の完全廃止は実現可能。  
-**推奨**: フェーズ1(apps/app)を優先実施し、早期に成果を得る。  
-**総工数**: 8.5-11.5日(フェーズ1+2)で主要な廃止が完了。

+ 0 - 695
.serena/memories/useSWRStatic-deprecation-progress.md

@@ -1,695 +0,0 @@
-# useSWRStatic / useStaticSWR 廃止計画 - 進捗レポート
-
-**作成日**: 2025-10-06  
-**最終更新**: 2025-10-06  
-**作成者**: GitHub Copilot  
-**目標**: `useSWRStatic`と`useStaticSWR`を完全廃止する
-
----
-
-## 📊 進捗状況
-
-### 全体進捗
-- **完了**: 6/8 箇所 (75%) ✅
-- **残り**: 2箇所
-  - **apps/app**: 2箇所(usePersonalSettings, use-static-swr.ts)
-  - **packages/editor**: 1箇所(useCodeMirrorEditorIsolated)
-- **apps/app**: Socket関連すべて完了 ✅
-- **packages/editor**: Playground完了、codemirror-editorのみ残存 ⏳
-
-**注**: `stores/websocket.tsx` の useGlobalAdminSocket は実は存在せず、useAdminSocket の誤認識だったため、カウントから除外
-
----
-
-## ✅ 完了した移行
-
-### ステップ1-1: useIsMaintenanceMode 重複解消 ✅
-
-**実施日**: 2025-10-06  
-**工数**: 0.5日  
-**優先度**: 🔴 最高
-
-#### 実施内容
-
-**問題**:
-- `stores/maintenanceMode.tsx` - useStaticSWR使用(旧実装)
-- `states/global/global.ts` - isMaintenanceModeAtom存在(Jotai)
-- 同じ状態を2箇所で管理していた
-
-**解決策**:
-```
-states/global/global.ts
-├── isMaintenanceModeAtom (状態管理)
-├── useIsMaintenanceMode() (読み取り)
-└── _atomsForMaintenanceMode (特殊名export)
-
-client/services/maintenance-mode.ts
-└── useMaintenanceModeActions() (ビジネスロジック)
-    ├── start()
-    └── end()
-```
-
-**削除したファイル**:
-- ✅ `stores/maintenanceMode.tsx`
-- ✅ `states/system/` ディレクトリ全体
-
-**更新したファイル**:
-- ✅ `states/global/global.ts` - atom追加、`_atomsForMaintenanceMode` export
-- ✅ `states/global/hydrate.ts` - hydration更新
-- ✅ `client/services/maintenance-mode.ts` - 新規作成(actions)
-- ✅ `client/components/Admin/App/MaintenanceMode.tsx` - import更新
-- ✅ `client/components/Admin/App/AppSettingsPageContents.tsx` - import更新
-
-**使用箇所**: 2箇所更新完了
-- `Admin/App/MaintenanceMode.tsx`
-- `Admin/App/AppSettingsPageContents.tsx`
-
-**達成効果**:
-- ✅ 重複コード削除
-- ✅ 責務分離(states ↔ services)
-- ✅ useSWRStatic使用箇所 -1
-- ✅ 型エラー 0件
-
----
-
-### ステップ1-2: useGlobalAdminSocket 削除(誤実装) ✅
-
-**実施日**: 2025-10-06  
-**工数**: 0.3日  
-**優先度**: 🔴 緊急(バグ修正)
-
-#### 実施内容
-
-**問題発見**:
-- `stores/websocket.tsx` の `useGlobalAdminSocket` は実は**存在しなかった**
-- 実際には `states/system/socket.ts` の `useAdminSocket()` が既存のJotai実装
-- 誤って `states/socket-io/admin-socket.ts` を作成してしまい、非機能的な実装となっていた
-- Atomが初期化されず、常に `undefined` を返していた
-
-**正しい状況の理解**:
-```
-既存の実装:
-├── states/system/socket.ts
-│   ├── useDefaultSocket() - Jotai + atomWithLazy
-│   └── useAdminSocket() - Jotai + atomWithLazy ← 正解
-└── stores/socket-io.ts
-    ├── useDefaultSocket() - SWR (12箇所で使用中)
-    └── useAdminSocket() - SWR (12箇所で使用中) ← 別途移行が必要
-```
-
-**解決策**:
-```
-V5PageMigration.tsx
-└── useAdminSocket() from '~/features/admin/states/socket-io'
-    └── atomWithLazy(() => socketFactory('/admin'))
-        └── Socket instance (遅延作成)
-```
-
-**削除したファイル**:
-- ✅ `states/socket-io/admin-socket.ts` - 誤実装を削除
-
-**更新したファイル**:
-- ✅ `states/socket-io/index.ts` - admin-socket export削除
-- ✅ `client/components/Admin/App/V5PageMigration.tsx` - 正しいimportに修正
-
-**使用箇所**: 1箇所更新完了
-- `Admin/App/V5PageMigration.tsx` - `states/system/socket` の `useAdminSocket()` 使用
-
-**達成効果**:
-- ✅ 非機能的な実装削除
-- ✅ 既存のJotai実装を活用
-- ✅ `atomWithLazy` パターンの理解向上
-- ✅ 型エラー 0件
-
-**教訓**:
-- 既存コードの完全な理解が重要
-- 移行前に全ての関連実装を調査すべき
-- `states/system/socket.ts` は既にベストプラクティス実装だった
-
----
-
-## 🔴 apps/app での残り使用箇所(4箇所)
-
-### 1. **stores/personal-settings.tsx** - usePersonalSettings
-- **現状**: `useStaticSWR` 使用(DB同期用の中間キャッシュ)
-- **使用箇所**: 12箇所(Me設定画面、DrawioModal、TemplateModal等)
-- **役割**: `/personal-setting` API から取得したユーザー情報のキャッシュ管理
-- **複雑度**: 🟡 中
-- **推定工数**: 2-3日
-- **優先度**: 🟡 中
-- **ステータス**: ⏳ 未着手
-
-**移行方針**:
-```typescript
-// states/user/personal-settings.ts
-const personalSettingsAtom = atom<IUser | undefined>(undefined);
-
-export const usePersonalSettings = () => useAtomValue(personalSettingsAtom);
-
-export const usePersonalSettingsActions = () => {
-  const setPersonalSettings = useSetAtom(personalSettingsAtom);
-  const { mutate: revalidateDB } = useSWRxPersonalSettings();
-  
-  const sync = useCallback(async () => {
-    const result = await revalidateDB();
-    setPersonalSettings(result);
-  }, [setPersonalSettings, revalidateDB]);
-  
-  return { sync, updateBasicInfo, /* ... */ };
-};
-```
-
----
-
-### 2. **stores/socket-io.ts** - useAdminSocket (SWR版)
-- **現状**: `useSWRImmutable` 使用(WebSocket管理)
-- **使用箇所**: 12箇所(管理画面の複数コンポーネント)
-- **役割**: Admin Socket の管理(SWR版)
-- **複雑度**: � 中
-- **推定工数**: 1-1.5日
-- **優先度**: � 中
-- **ステータス**: ⏳ 未着手
-
-**注**: `states/system/socket.ts` に既にJotai版の `useAdminSocket()` が存在するため、12箇所の使用箇所を順次移行
-
-**使用コンポーネント**:
-- ElasticsearchManagement系: 2箇所
-- ExportArchiveDataPage: 1箇所
-- G2GDataTransfer: 1箇所
-- ImportForm: 1箇所
-- ExternalUserGroup/SyncExecution: 1箇所
-- RebuildIndexControls: 1箇所
-- その他: 5箇所
-
-**移行方針**:
-- `states/system/socket.ts` の `useAdminSocket()` を使用(既存のJotai実装)
-- `{ data: socket }` → `socket` に修正(戻り値の型が異なる)
-
----
-
-### 3. **stores-universal/use-context-swr.tsx** - useContextSWR
-- **現状**: `useSWRStatic` 使用
-- **使用箇所**: 0箇所(internal definition only)
-- **役割**: Context用の SWR wrapper(mutate禁止)
-- **複雑度**: 🟢 低
-- **推定工数**: 0.1日
-- **優先度**: 🟢 低
-- **ステータス**: ⏳ 未着手
-
-**移行方針**: 使用箇所がないため即座に削除可能
-
----
-
-### 4. **stores/use-static-swr.ts**
-- **現状**: `@deprecated` - `useSWRStatic` の再エクスポート
-- **ステータス**: ⭐ **最終削除対象**(上記3つの完了後)
-- **推定工数**: 0.1日
-
----
-
-## 🔴 packages/editor での使用箇所(1箇所)
-
-### 1. **stores/codemirror-editor.ts** - useCodeMirrorEditorIsolated
-- **現状**: `useSWRStatic` + `useRef`
-- **使用箇所**: 20+箇所(パッケージ全体に浸透)
-- **役割**: CodeMirrorインスタンスの分離管理
-- **複雑度**: 🟡 中
-- **推定工数**: 5-7日
-- **優先度**: 🔴 高
-- **ステータス**: ⏳ 未着手
-- **詳細**: `packages-editor-jotai-migration-plan.md` 参照
-
-**影響範囲**:
-- Playground系: 3箇所
-- Toolbar系: 9箇所
-- Component系: 4箇所
-- Controller系: 4箇所
-
-**移行方針**:
-```typescript
-// packages/editor/src/states/codemirror-editor.ts
-type CodeMirrorEditorData = Map<string, UseCodeMirrorEditor>;
-const codeMirrorEditorMapAtom = atom<CodeMirrorEditorData>(new Map());
-
-export const useCodeMirrorEditor = (key: string | null) => {
-  const editorMap = useAtomValue(codeMirrorEditorMapAtom);
-  return key ? editorMap.get(key) ?? null : null;
-};
-```
-
----
-
-## 📋 推奨実施順序
-
-### Phase 1: apps/app の完了(残り工数: 3.2-4.7日)
-
-**優先順位**:
-1. ✅ **useIsMaintenanceMode** - 完了(0.5日)
-2. ✅ **useGlobalAdminSocket 削除** - 完了(0.3日、バグ修正)
-3. ⏳ **useContextSWR** - 次に実施、削除のみ(0.1日)
-4. ⏳ **useAdminSocket (SWR版)** - 新規追加、12箇所移行(1-1.5日)
-5. ⏳ **usePersonalSettings** - 最も複雑(2-3日)
-6. ⏳ **use-static-swr.ts** - 最終削除(0.1日)
-
-**Phase 1完了時**: `apps/app` での useSWRStatic **完全廃止** 🎉
-
----
-
-### Phase 2: packages/editor の完了(残り工数: 5-7日)
-
-**優先順位**:
-1. ✅ **Playground Socket** - 完了(0.5日)
-2. ⏳ **useCodeMirrorEditorIsolated** - 残り唯一のタスク(5-7日)
-
-**Phase 2完了時**: `packages/editor` での useSWRStatic **完全廃止** 🎉
-
----
-
-## 🎯 技術パターン(確立済み)
-
-### パターン1: 状態とアクションの分離
-
-```typescript
-// states/global/global.ts (状態管理)
-const fooAtom = atom<T>(initialValue);
-export const useFoo = () => useAtomValue(fooAtom);
-export const _atomsForFooActions = { fooAtom } as const;
-
-// client/services/foo.ts (ビジネスロジック)
-import { _atomsForFooActions } from '~/states/global';
-const { fooAtom } = _atomsForFooActions;
-
-export const useFooActions = () => {
-  const setFoo = useSetAtom(fooAtom);
-  
-  const doSomething = useCallback(async () => {
-    const result = await api();
-    setFoo(result);
-  }, [setFoo]);
-  
-  return { doSomething };
-};
-```
-
-**適用例**: ✅ useIsMaintenanceMode / useMaintenanceModeActions
-
----
-
-### パターン2: シンプルな状態管理
-
-```typescript
-// states/foo/bar.ts
-const barAtom = atom<T | undefined>(undefined);
-
-export const useBar = () => useAtomValue(barAtom);
-export const useSetBar = () => useSetAtom(barAtom);
-```
-
-**適用予定**: useGlobalAdminSocket
-
----
-
-### パターン3: SWRとJotaiの協調
-
-```typescript
-// SWR: DB通信・キャッシュ管理
-export const useSWRxFoo = () => {
-  return useSWR('/api/foo', fetcher);
-};
-
-// Jotai: クライアント状態管理
-const fooAtom = atom<T | undefined>(undefined);
-
-export const useFooActions = () => {
-  const setFoo = useSetAtom(fooAtom);
-  const { mutate: revalidateDB } = useSWRxFoo();
-  
-  const sync = useCallback(async () => {
-    const result = await revalidateDB();
-    setFoo(result);
-  }, [setFoo, revalidateDB]);
-  
-  return { sync };
-};
-```
-
-**適用予定**: usePersonalSettings
-
----
-
-## 📊 統計情報
-
-### コード削減
-- **削除ファイル数**: 4個
-  - apps/app: 3個(maintenanceMode.tsx, socket-io.ts, use-context-swr.tsx)
-  - packages/core: 1個(use-global-socket.ts)
-  - ディレクトリ: 1個(states/system/)
-- **削除行数**: ~300行以上
-  - maintenanceMode.tsx: ~32行
-  - socket-io.ts: ~80行
-  - use-context-swr.tsx: ~40行
-  - use-global-socket.ts: ~60行
-  - Playground.tsx: ~50行(Socket初期化コード)
-  - その他: ~40行(重複コード)
-
-### アーキテクチャ改善
-- ✅ 状態管理の責務分離(states ↔ services)
-- ✅ 重複コード削除(6箇所)
-- ✅ Socket接続の統合(useDefaultSocket と useGlobalSocket を統一)
-- ✅ パッケージ間の依存削減(@growi/core からSocket関連削除)
-- ✅ 型安全性の向上
-
-### パフォーマンス
-- ✅ 不適切なSWR使用の排除(6箇所)
-- ✅ 最適な再レンダリング制御
-- ✅ Socket接続の重複削減(2接続 → 1接続)
-- ✅ バンドルサイズ最適化(Dynamic Import活用)
-
----
-
-## 🎉 マイルストーン
-
-### マイルストーン1: apps/app 完全移行
-- **進捗**: 5/6 完了 (83%) ✅
-- **予想完了**: Phase 1 完了時
-- **残り工数**: 2-3日(usePersonalSettings + use-static-swr.ts)
-
-### マイルストーン2: packages/editor 完全移行
-- **進捗**: 1/2 完了 (50%) ✅
-- **予想完了**: Phase 2 完了時
-- **残り工数**: 5-7日(useCodeMirrorEditorIsolated のみ)
-
-### マイルストーン3: useSWRStatic 完全廃止
-- **進捗**: 6/8 完了 (75%) ✅
-- **予想完了**: Phase 1 + Phase 2 完了時
-- **残り工数**: 7-10日
-
----
-
-## 📚 関連ドキュメント
-
-- `apps-app-jotai-migration-progress.md` - apps/app Jotai移行完了レポート
-- `apps-app-jotai-migration-guidelines.md` - 技術パターン・ベストプラクティス
-- `packages-editor-jotai-migration-plan.md` - packages/editor 移行計画
-
----
-
-## 📝 学んだこと
-
-### アーキテクチャ設計
-1. **状態とロジックの分離**: `states/` は純粋な状態管理、`services/` はビジネスロジック
-2. **特殊名export**: `_atomsForFooActions` パターンで内部atomを安全に公開
-3. **責務の明確化**: SWR(通信)vs Jotai(状態)の役割分担
-
-### 移行のベストプラクティス
-1. **重複コード検出**: 新旧実装の共存を見逃さない
-2. **段階的移行**: 影響範囲の小さいものから順に実施
-3. **型チェック**: 各ステップで型エラー0を確認
-
----
-
-**次のアクション**: 
-- **Phase 1**: `usePersonalSettings` の移行(apps/app で最後の大きなタスク)
-- **Phase 2**: `useCodeMirrorEditorIsolated` の移行(packages/editor で唯一の残タスク)
-
----
-
-### ステップ1-3 & 1-4: socket-io.ts と use-context-swr.tsx 廃止 ✅
-
-**実施日**: 2025-10-06  
-**工数**: 1日  
-**優先度**: 🟡 中
-
-#### ステップ1-3: useAdminSocket / useDefaultSocket (SWR版) 廃止 ✅
-
-**問題**:
-- `stores/socket-io.ts` で SWR ベースの `useAdminSocket()` と `useDefaultSocket()` を実装
-- 8ファイルで使用(useAdminSocket: 6箇所、useDefaultSocket: 2箇所)
-- `states/system/socket.ts` に既にJotai実装が存在(`atomWithLazy`)
-
-**解決策**:
-- すべての使用箇所を `states/system/socket` に移行
-- `{ data: socket }` → `socket` に変更(SWRレスポンス構造不要)
-
-**削除したファイル**:
-- ✅ `stores/socket-io.ts`
-
-**更新したファイル**:
-- ✅ `client/components/Admin/G2GDataTransfer.tsx`
-- ✅ `client/components/Admin/ExportArchiveDataPage.tsx`
-- ✅ `client/components/Admin/ElasticsearchManagement/ElasticsearchManagement.tsx`
-- ✅ `client/components/Admin/ElasticsearchManagement/RebuildIndexControls.jsx`
-- ✅ `client/components/Admin/ImportData/GrowiArchive/ImportForm.jsx`
-- ✅ `features/external-user-group/client/components/ExternalUserGroup/SyncExecution.tsx`
-- ✅ `client/components/InAppNotification/InAppNotificationDropdown.tsx`
-- ✅ `client/components/Sidebar/InAppNotification/PrimaryItemForNotification.tsx`
-
-**達成効果**:
-- ✅ SWR ベースのSocket管理を完全廃止
-- ✅ `atomWithLazy` パターンの活用(遅延初期化)
-- ✅ コード統一(すべて `states/system/socket` から取得)
-- ✅ 型エラー 0件
-
-#### ステップ1-4: useContextSWR 削除 ✅
-
-**問題**:
-- 使用箇所が0箇所(定義のみ存在)
-
-**解決策**:
-- ファイルごと削除(既に削除済み)
-
-**削除したファイル**:
-- ✅ `stores-universal/use-context-swr.tsx`
-
-**達成効果**:
-- ✅ 不要コード削除
-
----
-
-### ステップ2-1: Playground Socket 廃止 ✅
-
-**実施日**: 2025-10-06  
-**工数**: 0.5日  
-**優先度**: 🟢 低
-
-#### 実施内容
-
-**問題**:
-- `packages/editor/src/client/components-internal/playground/Playground.tsx` で `useSWRStatic(GLOBAL_SOCKET_KEY)` を使用
-- Socket 初期化のために 50行以上のコードが重複
-- `mutate` 経由で Socket インスタンスを管理していた
-
-**解決策**:
-```
-packages/editor/src/client/states/socket.ts (新規作成)
-├── playgroundSocketAtom (Jotai atom)
-├── usePlaygroundSocket() (Socket取得)
-└── useSetupPlaygroundSocket() (初期化)
-```
-
-**作成したファイル**:
-- ✅ `packages/editor/src/client/states/socket.ts`
-
-**更新したファイル**:
-- ✅ `packages/editor/src/client/components-internal/playground/Playground.tsx`
-
-**削除されたコード**:
-- ✅ `useSWRStatic` import と使用
-- ✅ `GLOBAL_SOCKET_NS` と `GLOBAL_SOCKET_KEY` の定数定義(states/socket.ts に移動)
-- ✅ 手動 Socket 初期化の useEffect(50行以上)
-
-**達成効果**:
-- ✅ packages/editor で useSWRStatic 使用箇所 -1
-- ✅ apps/app と同じパターンで統一(Dynamic Import + Jotai)
-- ✅ コード削減(50行以上の初期化コードが不要に)
-- ✅ 型エラー 0件
-
----
-
-
-## 📋 更新された実施順序
-
-### Phase 1: apps/app の完了(残り工数: 2-3日)
-
-**完了済み**:
-1. ✅ **useIsMaintenanceMode** - 完了(0.5日)
-2. ✅ **useGlobalAdminSocket 削除** - 完了(0.3日、バグ修正)
-3. ✅ **useAdminSocket/useDefaultSocket (SWR版)** - 完了(1日)
-4. ✅ **useContextSWR** - 完了(0.1日)
-5. ✅ **useGlobalSocket (SWR版)** - 完了(0.5日)
-6. ✅ **Socket統合整理** - 完了(0.3日)
-
-**残りタスク**:
-7. ⏳ **usePersonalSettings** - 次に実施、最も複雑(2-3日)
-8. ⏳ **use-static-swr.ts** - 最終削除(0.1日)
-
-**Phase 1完了時**: `apps/app` での useSWRStatic **完全廃止** 🎉
-
----
-
-### Phase 2: packages/editor の移行(残り工数: 5-7日)
-
-**完了済み**:
-1. ✅ **Playground Socket** - 完了(0.5日)
-
-**残りタスク**:
-2. ⏳ **useCodeMirrorEditorIsolated** - 次に実施、最も複雑(5-7日)
-
-**Phase 2完了時**: `packages/editor` での useSWRStatic **完全廃止** 🎉
-
-詳細は `packages-editor-jotai-migration-plan.md` 参照。
-
-
----
-
-### ステップ1-5: useGlobalSocket (SWR版) 廃止 ✅
-
-**実施日**: 2025-10-06  
-**工数**: 0.5日  
-**優先度**: 🟡 中
-
-#### 実施内容
-
-**問題**:
-- `packages/core/src/swr/use-global-socket.ts` で SWR ベースの `useGlobalSocket()` を実装
-- 6ファイルで使用(ページ閲覧時のリアルタイム機能用)
-- `states/socket-io/socket-io.ts` に既にJotai実装が存在
-
-**解決策**:
-- すべての使用箇所を `states/socket-io` の Jotai実装に移行
-- `{ data: socket }` → `socket` に変更(SWRレスポンス構造不要)
-- `GLOBAL_SOCKET_NS` と `GLOBAL_SOCKET_KEY` を `states/socket-io/socket-io.ts` に移動
-
-**非推奨化したファイル**:
-- ⚠️ `packages/core/src/swr/use-global-socket.ts` (@deprecated 追加)
-
-**更新したファイル**:
-- ✅ `client/services/side-effects/page-updated.ts`
-- ✅ `client/components/PageEditor/conflict.tsx`
-- ✅ `client/components/ItemsTree/ItemsTree.tsx`
-- ✅ `features/collaborative-editor/side-effects/index.ts` (2箇所)
-- ✅ `features/search/client/components/PrivateLegacyPages.tsx`
-- ✅ `states/socket-io/socket-io.ts` (定数追加)
-
-**達成効果**:
-- ✅ SWR ベースのGlobalSocket管理を完全廃止
-- ✅ Dynamic Import + Jotai パターンの活用
-- ✅ ページルーム管理機能を維持(JoinPage/LeavePage)
-- ✅ 型エラー 0件
-
----
-
-## 🎉 Socket関連の整理完了
-
-### 現在のSocket実装状況
-
-#### `states/system/socket.ts` (管理機能用)
-- ✅ `useAdminSocket()` - Admin名前空間 (`/admin`)
-- ✅ `useDefaultSocket()` - Default名前空間 (`/`)
-- ✅ `useSocket(namespace)` - カスタム名前空間
-- ✅ **実装**: `atomWithLazy` (遅延初期化)
-- ✅ **特徴**: 同期的、シンプル
-
-#### `states/socket-io/socket-io.ts` (ページリアルタイム用)
-- ✅ `useGlobalSocket()` - Global Socket取得
-- ✅ `useSetupGlobalSocket()` - 初期化
-- ✅ `useSetupGlobalSocketForPage()` - ページルーム管理
-- ✅ **実装**: Dynamic Import + Jotai
-- ✅ **特徴**: バンドルサイズ最適化、ページ管理機能
-
-### 廃止されたSWR実装
-- ❌ `stores/socket-io.ts` - 削除済み
-- ⚠️ `packages/core/src/swr/use-global-socket.ts` - @deprecated
-
-
----
-
-## 🗑️ 完全削除されたファイル
-
-### packages/core/src/swr/use-global-socket.ts ✅
-
-**実施日**: 2025-10-06
-
-#### 削除内容
-- ❌ `useGlobalSocket()` - SWR版のフック(完全削除)
-- ❌ `GLOBAL_SOCKET_NS` - 定数(各パッケージに移動)
-- ❌ `GLOBAL_SOCKET_KEY` - 定数(各パッケージに移動)
-
-#### 移動先
-- ✅ `apps/app/src/states/socket-io/socket-io.ts` - Jotai実装 + 定数
-- ✅ `packages/editor/src/client/components-internal/playground/Playground.tsx` - 定数のみローカル定義
-
-#### 更新したファイル
-- ✅ `packages/core/src/swr/index.ts` - export削除
-- ✅ `packages/editor/src/client/components-internal/playground/Playground.tsx` - 定数をローカル定義
-
-**達成効果**:
-- ✅ `@growi/core` からSocket関連コードを完全削除
-- ✅ パッケージごとに独立した実装を保持
-- ✅ 循環依存を回避
-
-
----
-
-## 🔄 Socket実装の統合・整理 ✅
-
-**実施日**: 2025-10-06
-
-### 問題
-`useDefaultSocket` と `useGlobalSocket` が同じ `/` 名前空間に重複して接続していた:
-- ❌ **重複接続**: 2つの独立したSocket接続が存在
-- ❌ **役割不明確**: どちらを使うべきか曖昧
-- ❌ **非効率**: 同じ名前空間に2つのコネクション
-
-### 実施内容
-
-#### 1. `useDefaultSocket` を `useGlobalSocket` に統一
-
-**削除した実装**:
-- ❌ `states/system/socket.ts` の `useDefaultSocket()` と `defaultSocketAtom`
-
-**移行したファイル**:
-- ✅ `client/components/InAppNotification/InAppNotificationDropdown.tsx`
-- ✅ `client/components/Sidebar/InAppNotification/PrimaryItemForNotification.tsx`
-
-#### 2. ファイルリネーム(役割明確化)
-- 📝 `states/socket-io/socket-io.ts` → `states/socket-io/global-socket.ts`
-
-### 最終的なSocket構成
-
-#### `states/system/socket.ts` (管理機能専用)
-```typescript
-useAdminSocket()     // /admin 名前空間
-useSocket(namespace) // カスタム名前空間
-```
-- **用途**: 管理画面のSocket通信
-- **特徴**: atomWithLazy、同期的初期化
-
-#### `states/socket-io/global-socket.ts` (ページ機能専用)
-```typescript
-useGlobalSocket()              // / 名前空間 (8箇所で使用)
-useSetupGlobalSocket()         // 初期化
-useSetupGlobalSocketForPage()  // ページルーム管理
-```
-- **用途**: ページ閲覧時のリアルタイム機能
-- **特徴**: Dynamic Import、ページルーム管理
-
-### 使用箇所(全8箇所)
-
-**通知系 (2箇所):**
-1. `InAppNotificationDropdown.tsx` - 通知更新イベント
-2. `PrimaryItemForNotification.tsx` - 通知バッジ更新
-
-**ページ系 (6箇所):**
-3. `page-updated.ts` - ページ更新検知
-4. `conflict.tsx` - 編集競合検知
-5. `ItemsTree.tsx` - ページツリー更新
-6. `PrivateLegacyPages.tsx` - ページ移行進捗
-7-8. `collaborative-editor/side-effects` - YJS同期(2箇所)
-
-### 達成効果
-- ✅ Socket接続の重複を解消(2接続 → 1接続)
-- ✅ 役割を明確化(管理機能 vs ページ機能)
-- ✅ 効率化(同じ名前空間への無駄な接続を削減)
-- ✅ 型エラー 0件
-