diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index 098991fe8..b37fa1377 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -3,8 +3,6 @@ import { useRouter, useRoute } from 'vue-router'; import axios from 'axios'; import { useArrayDataStore } from 'stores/useArrayDataStore'; import { buildFilter } from 'filters/filterPanel'; -import { isDialogOpened } from 'src/filters'; -import useOpenURL from './useOpenURL'; const arrayDataStore = useArrayDataStore(); @@ -66,7 +64,7 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function fetch({ append = false, updateRouter = true, newTab = false }) { + async function fetch({ append = false, updateRouter = true }) { if (!store.url) return; cancelRequest(); @@ -111,8 +109,6 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { params.filter.where = { ...params.filter.where, ...exprFilter }; params.filter = JSON.stringify(params.filter); - if (newTab) return updateStateParams(true); - store.isLoading = true; const response = await axios.get(store.url, { signal: canceller.signal, @@ -127,7 +123,8 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { for (const row of response.data) store.data.push(row); } else { store.data = response.data; - if (!isDialogOpened()) updateRouter && updateStateParams(); + if (!document.querySelectorAll('[role="dialog"][aria-modal="true"]').length) + updateRouter && updateStateParams(); } store.isLoading = false; @@ -157,12 +154,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { } } - async function applyFilter({ filter, params, newTab }) { + async function applyFilter({ filter, params }) { if (filter) store.userFilter = filter; store.filter = {}; if (params) store.userParams = { ...params }; - const response = await fetch({ newTab }); + const response = await fetch({}); return response; } @@ -258,14 +255,12 @@ export function useArrayData(key = useRoute().meta.moduleName, userOptions) { if (Object.values(store.userParams).length) await fetch({}); } - function updateStateParams(newTab) { + function updateStateParams() { if (!route?.path) return; const newUrl = { path: route.path, query: { ...(route.query ?? {}) } }; if (store?.searchUrl) newUrl.query[store.searchUrl] = JSON.stringify(store.currentFilter); - if (newTab) useOpenURL(router.resolve(newUrl).href); - if (store.navigate) { const { customRouteRedirectName, searchText } = store.navigate; if (customRouteRedirectName)