Skip to content

Commit

Permalink
update description for historyItemsStore
Browse files Browse the repository at this point in the history
and revert `itemsLoaded` to computed
  • Loading branch information
ahmedhamidawan committed Oct 23, 2023
1 parent 4e68265 commit d67f859
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
15 changes: 5 additions & 10 deletions client/src/components/History/CurrentHistory/HistoryPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export default {
operationRunning: null,
operationError: null,
querySelectionBreak: false,
itemsLoaded: [],
};
},
computed: {
Expand Down Expand Up @@ -271,6 +270,10 @@ export default {
return "";
}
},
/** @returns {Array} */
itemsLoaded() {
return this.getHistoryItems(this.historyId, this.filterText);
},
},
watch: {
queryKey() {
Expand Down Expand Up @@ -338,22 +341,14 @@ export default {
try {
await this.fetchHistoryItems(this.historyId, this.filterText, this.offset);
this.searchError = null;
this.loading = false;
} catch (error) {
if (error.response && error.response.data && error.response.data.err_msg) {
console.debug("HistoryPanel - Load items error:", error.response.data.err_msg);
this.searchError = error.response.data;
} else {
console.debug("HistoryPanel - Load items error.", error);
}
} finally {
this.itemsLoaded = this.getHistoryItems(this.historyId, this.filterText);
if (this.invisible) {
this.itemsLoaded.forEach((item) => {
if (this.invisible[item.hid]) {
Vue.set(this.invisible, item.hid, false);
}
});
}
this.loading = false;
}
},
Expand Down
6 changes: 4 additions & 2 deletions client/src/stores/historyItemsStore.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* Requests history items by reacting to changes of filter props passed
* to the history items provider used in the history panel.
* Fetches history items from the API and stores them by `historyId`.
* A computed getter returns items for the given `historyId` and
* `filterText`.
*/

import { reverse } from "lodash";
Expand Down Expand Up @@ -72,6 +73,7 @@ export const useHistoryItemsStore = defineStore("historyItemsStore", () => {
// if related filter is included, set keys in state
if (relatedHid) {
payload.forEach((item: HistoryItem) => {
// current `item.hid` is related to item with hid = `relatedHid`
const relationKey = `${historyId}-${relatedHid}-${item.hid}`;
Vue.set(relatedItems.value, relationKey, true);
});
Expand Down

0 comments on commit d67f859

Please sign in to comment.