feat: sync connection settings across browsers via chrome.storage.sync#9
Merged
mkobayashime merged 5 commits intomainfrom Feb 5, 2026
Merged
feat: sync connection settings across browsers via chrome.storage.sync#9mkobayashime merged 5 commits intomainfrom
mkobayashime merged 5 commits intomainfrom
Conversation
- groovy-tumbling-clover.md: detailed implementation plan covering type splits, dual-storage layout, orphan resolution, migration, and verification steps - sync-connections.md: original requirement in Japanese
Partition the flat Connection type into two concerns: - ConnectionConfig: repo settings and enabled flag, intended for chrome.storage.sync - ConnectionState: browser-specific folder ID and sync timestamps, stays in chrome.storage.local The merged Connection = ConnectionConfig & ConnectionState type is retained so call sites require no changes. Also add the store-level Record types (SyncConnectionsStore, LocalConnectionStateStore).
Replace the single chrome.storage.local array with a split layout: - Connection configs live in chrome.storage.sync under "sync:gitmarks_connections" so they propagate across browsers automatically. - Per-browser state (folder IDs, sync timestamps) stays in chrome.storage.local under "local:gitmarks_connection_state". connections.ts changes: - getConnections merges the two stores, returning only fully-resolved entries (both config and state present). - saveConnection / updateConnection route fields to the correct store; updateConnection auto-detects config vs state keys. - removeConnection deletes from both stores atomically. - Expose getSyncConfigs / getLocalStates for use by orphan resolution. New orphan-configs.ts: - getOrphanConfigs: finds configs synced from another browser that have no local state yet. - autoResolveOrphanConfigs: recreates the bookmark folder hierarchy at the synced path and initialises local state, returning the count of newly resolved connections. - cleanupDeletedConnections: removes local state for connections whose config has been deleted on another browser.
On mount, run cleanupDeletedConnections (removes stale local state) and autoResolveOrphanConfigs (creates folders + local state for configs that arrived via chrome.storage.sync from another browser), then refresh the connection list. Also listen to chrome.storage.onChanged: when the sync store changes, repeat cleanup + resolution and refresh if any new connections were resolved. This keeps the UI in sync without a page reload when a connection is added or removed on another browser.
Document the new cross-browser sync model: ConnectionConfig/ ConnectionState type split, dual chrome.storage layout, orphan-config resolution flow, and the updated data-flow and storage-architecture sections.
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
Connectiontype intoConnectionConfig(synced) andConnectionState(local), keeping the merged type for backward compatibility.lib/storage/connections.tsto usechrome.storage.syncfor repo settings andchrome.storage.localfor per-browser state (folder IDs, sync timestamps).lib/storage/orphan-configs.tsto auto-resolve configs that arrive via sync but have no local state yet (recreates the bookmark folder hierarchy at the synced path), and to clean up local state when a connection is deleted on another browser.App.tsx: run on mount and re-run whenever the sync store changes, keeping the UI up to date without a reload.Design decisions
targetFolderPathis included in the synced config specifically so the folder hierarchy can be recreated on other browsers.Test plan
lastSyncedAton Browser B remains unchanged (state independence)