Can't suceed to make staleTime work ?
Hey folks !
Any reason why
const collection = createCollection(
queryCollectionOptions<RowWrapper<RowData<S, K>>>({
id: collectionId,
queryKey: [this.schema.database.name, this.name],
queryClient,
getKey: (row) => row.key,
// syncMode: "on-demand",
staleTime: 0,
queryFn: async (ctx) => {
const options = ctx.meta?.loadSubsetOptions;
const parsed = parseLoadSubsetOptionsWithIlike(options);
alert();
return await this.schema.database.query(this.name, {
...parsed,
offset: options?.offset,
});
},
})
);
...
const liveQuery = createLiveQueryCollection((q) => q
.from({ row: this.collection })
.select(({ row }) => ({
key: row.key,
data: {
[orderColumn.name]: row.data[orderColumn.name],
},
}))
.orderBy(({ row }) => unref(row).data[orderColumn.name])
.limit(limit ?? 50)
.offset(offset ?? 0)); const collection = createCollection(
queryCollectionOptions<RowWrapper<RowData<S, K>>>({
id: collectionId,
queryKey: [this.schema.database.name, this.name],
queryClient,
getKey: (row) => row.key,
// syncMode: "on-demand",
staleTime: 0,
queryFn: async (ctx) => {
const options = ctx.meta?.loadSubsetOptions;
const parsed = parseLoadSubsetOptionsWithIlike(options);
alert();
return await this.schema.database.query(this.name, {
...parsed,
offset: options?.offset,
});
},
})
);
...
const liveQuery = createLiveQueryCollection((q) => q
.from({ row: this.collection })
.select(({ row }) => ({
key: row.key,
data: {
[orderColumn.name]: row.data[orderColumn.name],
},
}))
.orderBy(({ row }) => unref(row).data[orderColumn.name])
.limit(limit ?? 50)
.offset(offset ?? 0));Any reason why
staleTime: 0staleTime: 0 do not work ? The alert()alert() is shown only once, then subsequent requests hit the cache. I am using DB on server and I want a way to have collections shared during a request only.