Update main bookmarks after action
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
|||||||
|
|
||||||
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
import 'package:linkdy/screens/bookmarks/provider/favicon_loader.provider.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
import 'package:linkdy/screens/bookmarks/provider/common_functions.dart';
|
||||||
|
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||||
import 'package:linkdy/screens/filtered_bookmarks/model/filtered_bookmarks.model.dart';
|
import 'package:linkdy/screens/filtered_bookmarks/model/filtered_bookmarks.model.dart';
|
||||||
|
|
||||||
import 'package:linkdy/models/data/bookmarks.dart';
|
import 'package:linkdy/models/data/bookmarks.dart';
|
||||||
@@ -174,6 +175,9 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
if (result == true) {
|
if (result == true) {
|
||||||
state.bookmarks = state.bookmarks.where((b) => b.id != bookmark.id).toList();
|
state.bookmarks = state.bookmarks.where((b) => b.id != bookmark.id).toList();
|
||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
|
ref
|
||||||
|
.read(bookmarksProvider.notifier)
|
||||||
|
.setBookmarks(ref.read(bookmarksProvider).bookmarks.where((b) => b.id != bookmark.id).toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,6 +191,9 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
state.bookmarks = state.bookmarks.map((b) => b.id == result.id ? result : b).toList();
|
state.bookmarks = state.bookmarks.map((b) => b.id == result.id ? result : b).toList();
|
||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
|
ref
|
||||||
|
.read(bookmarksProvider.notifier)
|
||||||
|
.setBookmarks(ref.read(bookmarksProvider).bookmarks.map((b) => b.id == result.id ? result : b).toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,8 +206,9 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
);
|
);
|
||||||
if (result == true) {
|
if (result == true) {
|
||||||
state.bookmarks = state.bookmarks.where((b) => b.id != bookmark.id).toList();
|
state.bookmarks = state.bookmarks.where((b) => b.id != bookmark.id).toList();
|
||||||
}
|
|
||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
|
ref.read(bookmarksProvider.notifier).refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void shareUnshare(Bookmark bookmark) async {
|
void shareUnshare(Bookmark bookmark) async {
|
||||||
@@ -216,5 +224,10 @@ class FilteredBookmarks extends _$FilteredBookmarks {
|
|||||||
state.bookmarks = state.bookmarks.map((b) => b.id == result.id ? result : b).toList();
|
state.bookmarks = state.bookmarks.map((b) => b.id == result.id ? result : b).toList();
|
||||||
}
|
}
|
||||||
ref.notifyListeners();
|
ref.notifyListeners();
|
||||||
|
if (result != null) {
|
||||||
|
ref
|
||||||
|
.read(bookmarksProvider.notifier)
|
||||||
|
.setBookmarks(ref.read(bookmarksProvider).bookmarks.map((b) => b.id == result.id ? result : b).toList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ final filteredBookmarksRequestLoadMoreProvider =
|
|||||||
|
|
||||||
typedef FilteredBookmarksRequestLoadMoreRef
|
typedef FilteredBookmarksRequestLoadMoreRef
|
||||||
= AutoDisposeFutureProviderRef<void>;
|
= AutoDisposeFutureProviderRef<void>;
|
||||||
String _$filteredBookmarksHash() => r'acb051c3b3e53c084c8c33d6ec1e80a1aa2a10f7';
|
String _$filteredBookmarksHash() => r'fdd67391d76f2bf8fd879b2f64a30d54922c4938';
|
||||||
|
|
||||||
/// See also [FilteredBookmarks].
|
/// See also [FilteredBookmarks].
|
||||||
@ProviderFor(FilteredBookmarks)
|
@ProviderFor(FilteredBookmarks)
|
||||||
|
|||||||
Reference in New Issue
Block a user