mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 14:31:13 -05:00
Refactor: Implement API and cache improvements
This commit is contained in:
@@ -98,12 +98,12 @@ if (import.meta.env.DEV) {
|
||||
const cache = queryClient.getQueryCache();
|
||||
const queries = cache.getAll();
|
||||
|
||||
// Remove oldest queries if cache exceeds 150 items
|
||||
if (queries.length > 150) {
|
||||
// Remove oldest queries if cache exceeds 250 items (increased limit)
|
||||
if (queries.length > 250) {
|
||||
const sortedByLastUpdated = queries
|
||||
.sort((a, b) => (a.state.dataUpdatedAt || 0) - (b.state.dataUpdatedAt || 0));
|
||||
|
||||
const toRemove = sortedByLastUpdated.slice(0, queries.length - 100);
|
||||
const toRemove = sortedByLastUpdated.slice(0, queries.length - 200);
|
||||
toRemove.forEach(query => {
|
||||
queryClient.removeQueries({ queryKey: query.queryKey });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user