Skip to content

Commit

Permalink
fix: make data-query-handler more robust to prevent updates of the ro…
Browse files Browse the repository at this point in the history
…uter location if not mounted
  • Loading branch information
mad-nuts committed Mar 3, 2022
1 parent d3b6f68 commit 9b9ec63
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions iris-client-fe/src/components/pageable/data-query-handler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const DataQueryHandlerProps = Vue.extend({
@Component
export default class DataQueryHandler extends DataQueryHandlerProps {
initialized = false;
isMounted = false;
query: DataQuery = {
size: DEFAULT_PAGE_SIZE,
Expand All @@ -45,12 +45,16 @@ export default class DataQueryHandler extends DataQueryHandlerProps {
folder: getParamFromRoute("folder", this.$route),
};
}
this.initialized = true;
this.isMounted = true;
}
beforeDestroy() {
this.isMounted = false;
}
@Watch("query", { immediate: true, deep: true })
onQueryChange(newValue: DataQuery) {
if (this.routeControl && !this.initialized) return;
if (this.routeControl && !this.isMounted) return;
const query = {
...newValue,
sort: mapSortAttributes(newValue.sort),
Expand Down

0 comments on commit 9b9ec63

Please sign in to comment.