mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-19 10:43:08 +00:00
Improve pull request flow, add branch selection for worktree creation, fix auto-mode concurrency count (#787)
* Changes from fix/fetch-before-pull-fetch * feat: Improve pull request flow, add branch selection for worktree creation, fix for automode concurrency count * feat: Add validation for remote names and improve error handling * Address PR comments and mobile layout fixes * ``` refactor: Extract PR target resolution logic into dedicated service ``` * feat: Add app shell UI and improve service imports. Address PR comments * fix: Improve security validation and cache handling in git operations * feat: Add GET /list endpoint and improve parameter handling * chore: Improve validation, accessibility, and error handling across apps * chore: Format vite server port configuration * fix: Add error handling for gh pr list command and improve offline fallbacks * fix: Preserve existing PR creation time and improve remote handling
This commit is contained in:
@@ -431,18 +431,38 @@ export function useSettingsSync(): SettingsSyncState {
|
||||
return;
|
||||
}
|
||||
|
||||
// If projects array changed (by reference, meaning content changed), sync immediately
|
||||
// This is critical - projects list changes must sync right away to prevent loss
|
||||
// when switching between Electron and web modes or closing the app
|
||||
// If projects array changed *meaningfully*, sync immediately.
|
||||
// This is critical — projects list changes must sync right away to prevent loss
|
||||
// when switching between Electron and web modes or closing the app.
|
||||
//
|
||||
// We compare by content (IDs, names, and paths), NOT by reference. The background
|
||||
// reconcile in __root.tsx calls hydrateStoreFromSettings() with server data,
|
||||
// which always creates a new projects array (.map() produces a new reference).
|
||||
// A reference-only check would trigger an immediate sync-back to the server
|
||||
// with identical data, causing a visible re-render flash on mobile.
|
||||
if (newState.projects !== prevState.projects) {
|
||||
logger.info('[PROJECTS_CHANGED] Projects array changed, syncing immediately', {
|
||||
prevCount: prevState.projects?.length ?? 0,
|
||||
newCount: newState.projects?.length ?? 0,
|
||||
prevProjects: prevState.projects?.map((p) => p.name) ?? [],
|
||||
newProjects: newState.projects?.map((p) => p.name) ?? [],
|
||||
});
|
||||
syncNow();
|
||||
return;
|
||||
const prevIds = prevState.projects
|
||||
?.map((p) => JSON.stringify([p.id, p.name, p.path]))
|
||||
.join(',');
|
||||
const newIds = newState.projects
|
||||
?.map((p) => JSON.stringify([p.id, p.name, p.path]))
|
||||
.join(',');
|
||||
if (prevIds !== newIds) {
|
||||
logger.info('[PROJECTS_CHANGED] Projects array changed, syncing immediately', {
|
||||
prevCount: prevState.projects?.length ?? 0,
|
||||
newCount: newState.projects?.length ?? 0,
|
||||
});
|
||||
syncNow();
|
||||
// Don't return here — fall through so the general loop below can still
|
||||
// detect and schedule a debounced sync for other project-field mutations
|
||||
// (e.g. lastOpened) that the id/name/path comparison above doesn't cover.
|
||||
} else {
|
||||
// The projects array reference changed but id/name/path are identical.
|
||||
// This means nested project fields mutated (e.g. lastOpened, remotes).
|
||||
// Schedule a debounced sync so these mutations reach the server.
|
||||
logger.debug('[PROJECTS_NESTED_CHANGE] Projects nested fields changed, scheduling sync');
|
||||
scheduleSyncToServer();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if any other synced field changed
|
||||
|
||||
Reference in New Issue
Block a user