Skip to content

Commit

Permalink
fix(user prefs)
Browse files Browse the repository at this point in the history
- fix infinite updates reacting to changes on user prefs repo
  • Loading branch information
thiagocarvalhodev committed Oct 22, 2024
1 parent 307d9c1 commit 630ca0c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
1 change: 0 additions & 1 deletion lib/user/repositories/user_preferences_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ class _UserPreferencesRepository implements UserPreferencesRepository {
required UserPreferences Function(T) updateFunction,
}) async {
_currentUserPreferences = updateFunction(value);
_userPreferencesController.sink.add(_currentUserPreferences!);

final store = await _getStore();
if (value is String) {
Expand Down
30 changes: 0 additions & 30 deletions test/user/repositories/user_preferences_repository_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -183,39 +183,9 @@ void main() {

// Trigger preference changes
await repository.saveTheme(ArDriveThemes.dark);
var next = await queue.next;
var expected = initialPreferences.copyWith(
currentTheme: ArDriveThemes.dark,
);

expect(
next,
equals(expected),
);
await repository.saveLastSelectedDriveId('new_drive_id');
next = await queue.next;
expected = expected.copyWith(lastSelectedDriveId: 'new_drive_id');

expect(
next,
equals(expected),
);
await repository.saveShowHiddenFiles(true);
next = await queue.next;
expected = expected.copyWith(showHiddenFiles: true);

expect(
next,
equals(expected),
);
await repository.saveUserHasHiddenItem(true);
next = await queue.next;
expected = expected.copyWith(userHasHiddenDrive: true);

expect(
next,
equals(expected),
);

await repository.load();

Expand Down

0 comments on commit 630ca0c

Please sign in to comment.