Sets up global cache and uses it to fetch sessions

This commit is contained in:
2025-07-02 14:46:13 -07:00
parent f8130f0ba9
commit 32c5c40466
10 changed files with 310 additions and 28 deletions

View File

@@ -1,15 +1,20 @@
import { AutoSaveTextarea } from "@/components/AutoSaveTextarea";
import { useCache } from "@/context/cache/CacheContext";
import { pb } from "@/lib/pocketbase";
import type { Session } from "@/lib/types";
export const SessionEditForm = ({ session }: { session: Session }) => {
const cache = useCache();
async function saveStrongStart(strongStart: string) {
await pb.collection("documents").update(session.id, {
data: {
...session.data,
strongStart,
},
});
const freshRecord: Session = await pb
.collection("documents")
.update(session.id, {
data: {
...session.data,
strongStart,
},
});
cache.set(freshRecord);
}
return (