開発トラブルシューティング
Troubleshooting: Firefox Sync Discrepancy
Firefox環境での同期時データ表示不整合の原因と対処法
Troubleshooting: Firefox Sync Discrepancy
Issue
In Firefox, after a "Clear Local Database" followed by a "Restore" (Sync Download), the global data (AI Characters, Chat Prompts) may appear missing in the UI (e.g., "chat.noCharacter" labels), even though the data has been correctly downloaded and inserted into IndexedDB.
Root Cause
This appears to be a race condition or state staleness issue specific to Firefox's handling of IndexedDB transactions relative to React/Jotai state updates.
- The
importGlobalChunkfunction clears and repopulates thecharacterstable. - However, the in-memory Jotai atoms (
charactersAtom) do not always detect this change immediately or receive the updated data list upon the subsequentloadCharactersAtomcall.
Current Workaround
The system now explicitly triggers a reload of all relevant atoms (loadCharactersAtom, loadChatSessionsAtom, loadProjectAtom) immediately after the sync process completes (syncAtoms.ts).
Debugging Steps
If this issue resurfaces:
- Open DevTools -> Application -> Storage -> IndexedDB. Verify if the
characterstable actually contains data. - If data exists in DB but not UI, a page reload (
F5) should fix it. - Check
syncAtoms.tsto ensure the explicit reload logic is executing.