Document prisma example usage with resource invalidation middleware
n1ru4l opened this issue · 1 comments
n1ru4l commented
// Register Middleware for automatic model invalidation
prisma.$use(async (params, next) => {
const resultPromise = next(params);
if (params.action === "update") {
resultPromise.then((res) => {
if (res?.id) {
liveQueryStore.invalidate(`${params.model}:${res.id}`);
}
});
}
return resultPromise;
});
n1ru4l commented
I am no longer using prisma and don't wanna maintain docs for that