Drop history placeholder as it doesn't really help

This commit is contained in:
davelopez
2024-03-27 10:16:01 +01:00
parent 45e0539fa4
commit fd02efd4e6
+1 -14
View File
@@ -68,26 +68,13 @@ export const useHistoryStore = defineStore("historyStore", () => {
const getHistoryById = computed(() => {
return (historyId: string) => {
if (!storedHistories.value[historyId]) {
// Create a placeholder to avoid multiple requests for the same history
// and reuse the reference to avoid reactivity issues
storedHistories.value[historyId] = createHistoryPlaceholder(historyId);
// TODO: Try to remove this as it can cause computed side effects
loadHistoryById(historyId);
}
return storedHistories.value[historyId]!;
return storedHistories.value[historyId] ?? null;
};
});
function createHistoryPlaceholder(historyId: string) {
const history = {
id: historyId,
name: "Loading...",
contents_active: { active: 0, deleted: 0, hidden: 0 },
} as AnyHistory;
return history;
}
const getHistoryNameById = computed(() => {
return (historyId: string) => {
const history = getHistoryById.value(historyId);