You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/03/19 07:05:37 UTC
(incubator-devlake) 01/01: fix: no correct reset state
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch fix-data-scope-search
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 8ac983968a155ef877f8272d1bea3036740191c3
Author: mintsweet <0x...@gmail.com>
AuthorDate: Tue Mar 19 20:05:22 2024 +1300
fix: no correct reset state
---
.../src/plugins/components/data-scope-remote/search-remote.tsx | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
index 60913a7d0..f49a10244 100644
--- a/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
+++ b/config-ui/src/plugins/components/data-scope-remote/search-remote.tsx
@@ -53,12 +53,14 @@ export const SearchRemote = ({ plugin, connectionId, config, disabledScope, sele
});
const [search, setSearch] = useState<{
+ loading: boolean;
items: McsItem<T.ResItem>[];
currentItems: McsItem<T.ResItem>[];
query: string;
page: number;
total: number;
}>({
+ loading: true,
items: [],
currentItems: [],
query: '',
@@ -138,6 +140,7 @@ export const SearchRemote = ({ plugin, connectionId, config, disabledScope, sele
setSearch((s) => ({
...s,
+ loading: false,
items: [...allItems, ...newItems],
currentItems: newItems,
total: res.count,
@@ -173,7 +176,7 @@ export const SearchRemote = ({ plugin, connectionId, config, disabledScope, sele
prefix={<SearchOutlined />}
placeholder={config.searchPlaceholder ?? 'Search'}
value={search.query}
- onChange={(e) => setSearch({ ...search, query: e.target.value })}
+ onChange={(e) => setSearch({ ...search, query: e.target.value, loading: true, currentItems: [] })}
/>
{!searchDebounce ? (
<MillerColumnsSelect
@@ -203,7 +206,7 @@ export const SearchRemote = ({ plugin, connectionId, config, disabledScope, sele
columnCount={1}
columnHeight={300}
getCanExpand={() => false}
- getHasMore={() => search.total === 0}
+ getHasMore={() => search.loading}
onScroll={() => setSearch({ ...search, page: search.page + 1 })}
renderLoading={() => <Loading size={20} style={{ padding: '4px 12px' }} />}
disabledIds={(disabledScope ?? []).map((it) => it.id)}