mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
feat: enhance global settings update with data loss prevention
- Added safeguards to prevent overwriting non-empty arrays with empty arrays during global settings updates, specifically for the 'projects' field. - Implemented logging for updates to assist in diagnosing accidental wipes of critical settings. - Updated tests to verify that projects are preserved during logout transitions and that theme changes are ignored if a project wipe is attempted. - Enhanced the settings synchronization logic to ensure safe handling during authentication state changes.
This commit is contained in:
@@ -94,6 +94,17 @@ export function waitForMigrationComplete(): Promise<void> {
|
||||
return migrationCompletePromise;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset migration state when auth is lost (logout/session expired).
|
||||
* This ensures that on re-login, the sync hook properly waits for
|
||||
* fresh settings hydration before starting to sync.
|
||||
*/
|
||||
export function resetMigrationState(): void {
|
||||
migrationCompleted = false;
|
||||
migrationCompletePromise = null;
|
||||
migrationCompleteResolve = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse localStorage data into settings object
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user