Passes $route.query copy instead of reference in some functions.

This commit is contained in:
mateuswetah 2024-02-05 09:20:07 -03:00
parent 07f326fc7b
commit 0de8e09e30
2 changed files with 8 additions and 8 deletions

View File

@ -198,13 +198,13 @@ export default {
exitViewModeWithoutPagination() {
app.config.globalProperties.$eventBusSearchEmitter.emit( 'exitViewModeWithoutPagination', true);
},
async updateURLQueries() {
const newQueries = app.config.globalProperties.$store.getters['search/getPostQuery'];
await app.config.globalProperties.$router.replace({ path: app.config.globalProperties.$route.path, query: {} });
await app.config.globalProperties.$router.replace({ path: app.config.globalProperties.$route.path, query: newQueries });
updateURLQueries() {
const newQueries = JSON.parse(JSON.stringify(app.config.globalProperties.$store.getters['search/getPostQuery']));
//app.config.globalProperties.$router.replace({ path: app.config.globalProperties.$route.path, query: {} });
app.config.globalProperties.$router.replace({ path: app.config.globalProperties.$route.path, query: newQueries });
},
updateStoreFromURL() {
app.config.globalProperties.$store.dispatch('search/setPostQuery', app.config.globalProperties.$route.query);
app.config.globalProperties.$store.dispatch('search/setPostQuery', JSON.parse(JSON.stringify(app.config.globalProperties.$route.query)));
},
loadItems() {
// Forces fetch_only to be filled before any search happens

View File

@ -909,14 +909,14 @@
// Advanced Search
if (this.$route.query && this.$route.query.advancedSearch)
this.$store.dispatch('search/setAdvancedQuery', this.$route.query);
this.$store.dispatch('search/setAdvancedQuery', JSON.parse(JSON.stringify(this.$route.query)));
else
this.$store.dispatch('search/setPostQuery', this.$route.query);
this.$store.dispatch('search/setPostQuery', JSON.parse(JSON.stringify(this.$route.query)));
// Finally, loads items even berfore facets so they won't stuck them
if (to.fullPath != from.fullPath)
this.$eventBusSearch.loadItems();
// Checks current metaqueries and taxqueries to alert filters that should reload
// For some reason, this process is not working accessing to.query, so we need to check the path string.
const oldQueryString = from.fullPath.replace(from.path + '?', '');