#6992 add URL params #273

Merged
jorgep merged 6 commits from 6992-addQueryParamsUrl into dev 2024-04-10 06:45:15 +00:00
3 changed files with 15 additions and 7 deletions
Showing only changes of commit 8de3ea16a6 - Show all commits

View File

@ -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

View File

@ -105,7 +105,7 @@ export function useArrayData(key, userOptions) {
for (const row of response.data) store.data.push(row);
jorgep marked this conversation as resolved Outdated

Se que no lo has modificado, pero puedes eliminar el warning de la línea 18?

Se que no lo has modificado, pero puedes eliminar el warning de la línea 18?
} else {
store.data = response.data;
if (!document.querySelectorAll('[role="dialog"]'))
if (!document.querySelectorAll('[role="dialog"]').length)
jsegarra marked this conversation as resolved Outdated

Mmm, esa linea lleva ahi desde el 8/2/24...a ti te ha funcionado?Porque quizás habría que darle una vuelta, queryselectorAll siempre devolverá un array.
a lo mejor hacer length > 0
Así como curiosidad, GPT me ha dicho que use esta sentencia:
window.Quasar?.dialog?.manager?.__showing?.length > 0 pero no lo tengo claro

Mmm, esa linea lleva ahi desde el 8/2/24...a ti te ha funcionado?Porque quizás habría que darle una vuelta, queryselectorAll siempre devolverá un array. a lo mejor hacer length > 0 Así como curiosidad, GPT me ha dicho que use esta sentencia: ` window.Quasar?.dialog?.manager?.__showing?.length > 0` pero no lo tengo claro

Sí, la línea funciona. Hacer !array.length es lo mismo que !array.length>0 . he probado eso y no parece existir en el navegador

Sí, la línea funciona. Hacer !array.length es lo mismo que !array.length>0 . he probado eso y no parece existir en el navegador
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)

Esto redirige, por lo que no es lo más correcto. Alex y Juan me dan el ok.

Esto redirige, por lo que no es lo más correcto. Alex y Juan me dan el ok.
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();
jsegarra marked this conversation as resolved Outdated

porque no usas currentHash?
Idem para la siguiente linea

porque no usas currentHash? Idem para la siguiente linea

Porque currentRoute es solo la ruta . Ej. currentRoute = #/claim/list y currentHash = #/claim/list?order=priority+ASC%2Ccreated+DESC&limit=10&params=%7B%22clientName%22%3A%22br%22%7D . CurrentHash es la ruta con los parámetros actuales.

Porque currentRoute es solo la ruta . Ej. currentRoute = #/claim/list y currentHash = #/claim/list?order=priority+ASC%2Ccreated+DESC&limit=10&params=%7B%22clientName%22%3A%22br%22%7D . CurrentHash es la ruta con los parámetros actuales.
window.history.pushState({}, '', url);
}
const totalRows = computed(() => (store.data && store.data.length) || 0);

View File

@ -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));
});
};
});