File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import type { Models } from '@appwrite.io/console';
7
7
import { organization } from './organization' ;
8
8
import { page } from '$app/state' ;
9
9
import { user } from '$lib/stores/user' ;
10
+ import deepEqual from 'deep-equal' ;
10
11
11
12
type Preferences = {
12
13
limit ?: number ;
@@ -74,19 +75,17 @@ function createPreferences() {
74
75
* Update the local store and then synchronizes them on user prefs.
75
76
*/
76
77
function updateAndSync ( callback : ( prefs : PreferencesStore ) => void ) {
77
- let oldPrefsSnapshot : string ;
78
+ let oldPrefsSnapshot : PreferencesStore ;
78
79
let newPrefsSnapshot : PreferencesStore ;
79
80
80
81
update ( ( currentPrefs ) => {
81
- oldPrefsSnapshot = JSON . stringify ( currentPrefs ) ;
82
+ oldPrefsSnapshot = currentPrefs ;
82
83
callback ( currentPrefs ) ;
83
84
newPrefsSnapshot = currentPrefs ;
84
85
return currentPrefs ;
85
86
} ) ;
86
87
87
- // Skip API if no changes (sufficient for simple objects).
88
- // The key order seemed to be maintained during local tests.
89
- if ( oldPrefsSnapshot === JSON . stringify ( newPrefsSnapshot ) ) {
88
+ if ( deepEqual ( oldPrefsSnapshot , newPrefsSnapshot ) ) {
90
89
return ;
91
90
}
92
91
You can’t perform that action at this time.
0 commit comments