This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch release-v0.21
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.21 by this push:
new 85d8c14cf fix: no correct reset state (#7191) (#7192)
85d8c14cf is described below
commit 85d8c14cf63a60d6ca3dc7c2df6282869b07dcab
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Mar 19 21:32:13 2024 +1300
fix: no correct reset state (#7191) (#7192)
Co-authored-by: 青湛 <[email protected]>
---
.../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)}