pass filters when refreshing for domain assets (#19872)

* pass filters when refreshing assets

* verify query_filter being passed for refresh
This commit is contained in:
Karan Hotchandani 2025-02-19 14:00:47 +05:30 committed by GitHub
parent eddaf75121
commit 3be1a40c05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 0 deletions

View File

@ -344,9 +344,24 @@ export const addAssetsToDomain = async (
}
const assetsAddRes = page.waitForResponse(`/api/v1/domains/*/assets/add`);
const searchRes = page.waitForResponse((response) => {
const url = new URL(response.url());
const queryParams = new URLSearchParams(url.search);
const queryFilter = queryParams.get('query_filter');
return (
response
.url()
.includes('/api/v1/search/query?q=**&index=all&from=0&size=15') &&
queryFilter !== null &&
queryFilter !== ''
);
});
await page.getByTestId('save-btn').click();
await assetsAddRes;
await searchRes;
await page.reload();
await page.waitForLoadState('networkidle');

View File

@ -753,12 +753,19 @@ const AssetsTabs = forwardRef(
refreshAssets() {
// Reset page to one and trigger fetchAssets
handlePageChange(1);
const newFilter = getCombinedQueryFilterObject(
queryFilter as unknown as QueryFilterInterface,
quickFilterQuery as QueryFilterInterface
);
// If current page is already 1 it won't trigger fetchAset from useEffect
// Hence need to manually trigger it for this case
currentPage === 1 &&
fetchAssets({
index: isEmpty(activeFilter) ? [SearchIndex.ALL] : activeFilter,
page: 1,
queryFilter: newFilter,
});
},
closeSummaryPanel() {