fix(VnFilterPanel): emit userParams better #607
No reviewers
Labels
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: verdnatura/salix-front#607
Loading…
Reference in New Issue
No description provided.
Delete Branch "warmFix_vnFilterPanel_setUserParams"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -83,3 +83,3 @@
function setUserParams(watchedParams) {
if (!watchedParams) return;
if (!watchedParams || Object.keys(watchedParams).length == 0) return;
Hay casos que es objeto vacío y no queremos emitirlo
@ -90,2 +95,2 @@
userParams.value = { ...userParams.value, ...watchedParams };
emit('setUserParams', userParams.value);
userParams.value = { ...userParams.value, ...sanitizer(watchedParams) };
emit('setUserParams', userParams.value, order);
Si no emite el order, cuando se actualiza la url quita los ordenes del VnTable
@ -94,3 +99,3 @@
watch(
() => route.query[$props.searchUrl],
(val) => setUserParams(val)
(val, oldValue) => (val || oldValue) && setUserParams(val)
newVal, oldVal ?
@ -92,3 +96,4 @@
emit('setUserParams', userParams.value, order);
}
watch(
Puedes crear un watch para observar route.query[$props.searchUrl] y arrayData.store.userParams
Tipo esto:
watch( () => [route.query[$props.searchUrl], arrayData.store.userParams], ([newSearchUrl, newUserParams], [oldSearchUrl, oldUserParams]) => { if (newSearchUrl || oldSearchUrl) { setUserParams(newSearchUrl); } if (newUserParams || oldUserParams) { setUserParams(newUserParams); } } );