From 077b257316081ea4b145786a5a1d0252c1030d21 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Sat, 1 Feb 2020 21:20:13 +1100 Subject: [PATCH] Fix paging not working (#340) * Don't set total count while loading * Don't render pagination while loading --- ui/v2/src/hooks/ListHook.tsx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/ui/v2/src/hooks/ListHook.tsx b/ui/v2/src/hooks/ListHook.tsx index 20942e4e6..53ea3f515 100644 --- a/ui/v2/src/hooks/ListHook.tsx +++ b/ui/v2/src/hooks/ListHook.tsx @@ -348,6 +348,25 @@ export class ListHook { } }) : undefined; + function maybeRenderContent() { + if (!result.loading && !result.error) { + return options.renderContent(result, filter, selectedIds, zoomIndex); + } + } + + function maybeRenderPagination() { + if (!result.loading && !result.error) { + return ( + + ); + } + } + const template = (
0 ? options.renderSelectedOptions(result, selectedIds) : undefined} {result.loading || (!options.subComponent && !forageInitialised.current) ? : undefined} {result.error ?

{result.error.message}

: undefined} - {options.renderContent(result, filter, selectedIds, zoomIndex)} - + {maybeRenderContent()} + {maybeRenderPagination()}
);