From 2737accfffef38f78e756ad3fd218d1bc16a45af Mon Sep 17 00:00:00 2001 From: enm10k Date: Mon, 17 Jun 2024 09:58:04 +0900 Subject: [PATCH] Fix rowNestedProvider --- lib/features/core/components/child_list.dart | 2 +- lib/features/core/pages/link_record.dart | 15 ++++++++------- lib/features/core/providers/providers.dart | 7 +++++-- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/features/core/components/child_list.dart b/lib/features/core/components/child_list.dart index ff94967..ae4d7ac 100644 --- a/lib/features/core/components/child_list.dart +++ b/lib/features/core/components/child_list.dart @@ -166,7 +166,7 @@ class ChildList extends HookConsumerWidget { } context.loaderOverlay.show(); await ref - .watch(rowNestedProvider(rowId, column, relation).notifier) + .read(rowNestedProvider(rowId, column, relation).notifier) .load() .then((final _) { Future.delayed( diff --git a/lib/features/core/pages/link_record.dart b/lib/features/core/pages/link_record.dart index 939a5a8..a644290 100644 --- a/lib/features/core/pages/link_record.dart +++ b/lib/features/core/pages/link_record.dart @@ -31,16 +31,17 @@ class _Card extends HookConsumerWidget { subtitle: Text('PrimaryKey: $refRowId'), onTap: () async { await ref - .watch( + .read( rowNestedProvider(rowId, column, relation, excluded: true) .notifier, ) .link(refRowId: refRowId) - .then((final msg) => notifySuccess(context, message: msg)) - .onError( - (final error, final stackTrace) => - notifyError(context, error, stackTrace), - ); + .then((final msg) { + notifySuccess(context, message: msg); + }).onError( + (final error, final stackTrace) => + notifyError(context, error, stackTrace), + ); }, ), ); @@ -90,7 +91,7 @@ class LinkRecordPage extends HookConsumerWidget { } context.loaderOverlay.show(); await ref - .watch( + .read( rowNestedProvider(rowId, column, relation, excluded: true) .notifier, ) diff --git a/lib/features/core/providers/providers.dart b/lib/features/core/providers/providers.dart index 416c2ea..009c337 100644 --- a/lib/features/core/providers/providers.dart +++ b/lib/features/core/providers/providers.dart @@ -441,7 +441,7 @@ class RowNested extends _$RowNested { final String rowId, final NcTableColumn column, final NcTable relation, { - final excluded = false, + final bool excluded = false, }) async { final fn = excluded ? api.dbTableRowNestedChildrenExcludedList @@ -513,7 +513,10 @@ class RowNested extends _$RowNested { _invalidate() { ref ..invalidateSelf() - ..invalidate(dataRowsProvider); + ..invalidate(dataRowsProvider) + ..invalidate( + rowNestedProvider(rowId, column, relation, excluded: !excluded), + ); } Future remove({