mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-08 00:58:06 +00:00
Explore tree reset (#17653)
* reset tree state when quick filter is empty * cleanup (cherry picked from commit 55cbda4ea568dba1e54f1ea4671026ecdf6a3121)
This commit is contained in:
parent
34f94b8ed2
commit
e5e39f75f3
@ -819,6 +819,8 @@ test.describe('Glossary tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('Request tags for Glossary', async ({ browser }) => {
|
test('Request tags for Glossary', async ({ browser }) => {
|
||||||
|
test.slow(true);
|
||||||
|
|
||||||
const { page, afterAction, apiContext } = await performAdminLogin(browser);
|
const { page, afterAction, apiContext } = await performAdminLogin(browser);
|
||||||
const { page: page1, afterAction: afterActionUser1 } =
|
const { page: page1, afterAction: afterActionUser1 } =
|
||||||
await performUserLogin(browser, user2);
|
await performUserLogin(browser, user2);
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
import { Tree, Typography } from 'antd';
|
import { Tree, Typography } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isString, isUndefined } from 'lodash';
|
import { isEmpty, isString, isUndefined } from 'lodash';
|
||||||
import Qs from 'qs';
|
import Qs from 'qs';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
@ -76,7 +76,7 @@ const ExploreTree = ({ onFieldValueSelect }: ExploreTreeProps) => {
|
|||||||
return searchClassBase.getExploreTreeKey(tab as ExplorePageTabs);
|
return searchClassBase.getExploreTreeKey(tab as ExplorePageTabs);
|
||||||
}, [tab]);
|
}, [tab]);
|
||||||
|
|
||||||
const [searchQueryParam, defaultServiceType] = useMemo(() => {
|
const [parsedSearch, searchQueryParam, defaultServiceType] = useMemo(() => {
|
||||||
const parsedSearch = Qs.parse(
|
const parsedSearch = Qs.parse(
|
||||||
location.search.startsWith('?')
|
location.search.startsWith('?')
|
||||||
? location.search.substring(1)
|
? location.search.substring(1)
|
||||||
@ -89,7 +89,7 @@ const ExploreTree = ({ onFieldValueSelect }: ExploreTreeProps) => {
|
|||||||
? parsedSearch.search
|
? parsedSearch.search
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
return [searchQueryParam, defaultServiceType];
|
return [parsedSearch, searchQueryParam, defaultServiceType];
|
||||||
}, [location.search]);
|
}, [location.search]);
|
||||||
|
|
||||||
const handleChangeSearchIndex = (
|
const handleChangeSearchIndex = (
|
||||||
@ -299,6 +299,13 @@ const ExploreTree = ({ onFieldValueSelect }: ExploreTreeProps) => {
|
|||||||
fetchEntityCounts();
|
fetchEntityCounts();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Tree works on the quickFilter, so we need to reset the selectedKeys when the quickFilter is empty
|
||||||
|
if (isEmpty(parsedSearch.quickFilter)) {
|
||||||
|
setSelectedKeys([]);
|
||||||
|
}
|
||||||
|
}, [parsedSearch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tree
|
<Tree
|
||||||
blockNode
|
blockNode
|
||||||
|
Loading…
x
Reference in New Issue
Block a user