This is an automated email from the ASF dual-hosted git repository. abeizn pushed a commit to branch release-v1.0 in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit f0792057e2f1fccb7f582a75d6f05c21729d46d9 Author: 青湛 <[email protected]> AuthorDate: Tue Mar 19 21:10:50 2024 +1300 fix: no correct reset state (#7191) --- .../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)}
