diff --git a/CHANGELOG.md b/CHANGELOG.md index 555b4f0ba..9f493764a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +### Fixed + +- (General) => Se vuelven a mostrar los parĂ¡metros en la url al aplicar un filtro + ## [2414.01] - 2024-04-04 ### Added diff --git a/src/composables/useArrayData.js b/src/composables/useArrayData.js index b6b81f2d5..403683415 100644 --- a/src/composables/useArrayData.js +++ b/src/composables/useArrayData.js @@ -105,7 +105,7 @@ export function useArrayData(key, userOptions) { for (const row of response.data) store.data.push(row); } else { store.data = response.data; - if (!document.querySelectorAll('[role="dialog"]')) + if (!document.querySelectorAll('[role="dialog"]').length) updateRouter && updateStateParams(); } @@ -188,11 +188,15 @@ export function useArrayData(key, userOptions) { if (store.userParams && Object.keys(store.userParams).length !== 0) query.params = JSON.stringify(store.userParams); - if (router) - router.replace({ - path: route.path, - query: query, - }); + const url = new URL(window.location.href); + const { hash: currentHash } = url; + const [currentRoute] = currentHash.split('?'); + + const params = new URLSearchParams(); + for (const param in query) params.append(param, query[param]); + + url.hash = currentRoute + '?' + params.toString(); + window.history.pushState({}, '', url); } const totalRows = computed(() => (store.data && store.data.length) || 0); diff --git a/test/cypress/integration/vnSearchBar.spec.js b/test/cypress/integration/vnSearchBar.spec.js index 3db789773..f1f3a9e82 100644 --- a/test/cypress/integration/vnSearchBar.spec.js +++ b/test/cypress/integration/vnSearchBar.spec.js @@ -36,7 +36,7 @@ describe('VnSearchBar', () => { const checkCardListAndUrl = (expectedLength) => { cy.get(cardList).then(($cardList) => { expect($cardList.find('.q-card').length).to.equal(expectedLength); - cy.url().then((currentUrl) => expect(currentUrl).to.equal(url)); + cy.url().then((currentUrl) => expect(currentUrl).to.contain(url)); }); }; });