Skip to content

Instantly share code, notes, and snippets.

View mattrobrob's full-sized avatar
⌨️
typing

Matt Robinson mattrobrob

⌨️
typing
  • London, United Kingdom
View GitHub Profile
@mattrobrob
mattrobrob / soft-delete-filter.ts
Created June 22, 2026 15:25
Zero sync soft-delete filter — injects deletedAt IS NULL into every query AST (top-level, related(), whereExists()) at the server boundary
import { asQueryInternals, queryInternalsTag } from "@rocicorp/zero/bindings";
import type { AST, Condition, CorrelatedSubquery } from "@rocicorp/zero";
import type { Schema } from "@vestia/zero/schema";
/**
* Tables where soft-deleted rows should STILL be synced to the client
* so that child replies can render with "[deleted]" placeholders.
*
* For these tables, the mutator must zero out `body` (and any other
* sensitive fields) at soft-delete time. The client renders "[deleted]"
@mattrobrob
mattrobrob / auth.$path.tsx
Last active September 27, 2024 01:12
SST Ion Auth + Remix
export async function loader({ request, params }: LoaderFunctionArgs) {
if (params.path === "callback") {
const { searchParams } = new URL(request.url);
const code = searchParams.get("code");
if (code) {
const response = await fetch(import.meta.env.VITE_AUTH_URL + "/token", {
method: "POST",
body: new URLSearchParams({
grant_type: "authorization_code",