Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions frontend/src/ts/collections/custom-themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ const customThemesCollection = createCollection(
);
}

if (_keepAlive === null) {
_keepAlive = useCustomThemesLiveQuery();
}

return response.body.data.map(applyIdWorkaround);
},
}),
Expand Down Expand Up @@ -174,3 +178,10 @@ export const __nonReactive = {
getCustomThemes,
getCustomTheme,
};

/**
* On prod the collection gets cleaned up after a while.
* Keeping a query active fixes that. Remove when removing __nonReactive
*/
// oxlint-disable-next-line typescript/no-explicit-any
let _keepAlive: any = null;
6 changes: 6 additions & 0 deletions frontend/src/ts/collections/presets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,9 @@ export const __nonReactive = {
getPresets,
getPreset,
};

/**
* On prod the collection gets cleaned up after a while.
* Keeping a query active fixes that. Remove when removing __nonReactive
*/
const _keepAlive = usePresetsLiveQuery();
13 changes: 13 additions & 0 deletions frontend/src/ts/collections/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,12 @@ const resultsCollection = createCollection(
setLastResult(lastResult);
}

if (_keepAlive === null) {
_keepAlive = useLiveQuery((q) =>
q.from({ results: resultsCollection }),
);
}

return results;
},
queryClient,
Expand Down Expand Up @@ -683,3 +689,10 @@ function getResults(): SnapshotResult<Mode>[] {
export const __nonReactive = {
getResults,
};

/**
* On prod the collection gets cleaned up after a while.
* Keeping a query active fixes that. Remove when removing __nonReactive
*/
// oxlint-disable-next-line typescript/no-explicit-any
let _keepAlive: any = null;
7 changes: 7 additions & 0 deletions frontend/src/ts/collections/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const tagsCollection = createCollection(
queryFn: async () => {
const activeIds = activeTagsLS.get();
const userData = await fetchUserFromApi();

if (userData === undefined) return [];

return (userData.tags ?? [])
Expand Down Expand Up @@ -552,3 +553,9 @@ export const __nonReactive = {
getTag,
getActiveTags,
};

/**
* On prod the collection gets cleaned up after a while.
* Keeping a query active fixes that. Remove when removing __nonReactive
*/
const _keepAlive = useTagsLiveQuery();
Loading