1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 03:46:47 +01:00

fix(mobile): do not show loading overlay on grid refresh (#5531)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong 2023-12-07 18:21:07 +00:00 committed by GitHub
parent c5504aae6e
commit 3581069c2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -354,9 +354,12 @@ class MultiselectGrid extends HookConsumerWidget {
} }
} }
Future<T> Function() wrapLongRunningFun<T>(Future<T> Function() fun) => Future<T> Function() wrapLongRunningFun<T>(
Future<T> Function() fun, {
bool showOverlay = true,
}) =>
() async { () async {
processing.value = true; if (showOverlay) processing.value = true;
try { try {
final result = await fun(); final result = await fun();
if (result.runtimeType != bool || result == true) { if (result.runtimeType != bool || result == true) {
@ -364,7 +367,7 @@ class MultiselectGrid extends HookConsumerWidget {
} }
return result; return result;
} finally { } finally {
processing.value = false; if (showOverlay) processing.value = false;
} }
}; };
@ -383,7 +386,10 @@ class MultiselectGrid extends HookConsumerWidget {
selectionActive: selectionEnabledHook.value, selectionActive: selectionEnabledHook.value,
onRefresh: onRefresh == null onRefresh: onRefresh == null
? null ? null
: wrapLongRunningFun(onRefresh!), : wrapLongRunningFun(
onRefresh!,
showOverlay: false,
),
topWidget: topWidget, topWidget: topWidget,
showStack: stackEnabled, showStack: stackEnabled,
), ),