diff --git a/apps/dashboard/src/app/api/revalidate/route.ts b/apps/dashboard/src/app/api/revalidate/route.ts deleted file mode 100644 index 7f809ddb31..0000000000 --- a/apps/dashboard/src/app/api/revalidate/route.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { NextResponse } from "next/server"; - -export async function GET() { - return NextResponse.json({ ok: true }); -} diff --git a/apps/dashboard/src/jobs/transactions.ts b/apps/dashboard/src/jobs/transactions.ts index 6f6d7e5022..07e2f9689f 100644 --- a/apps/dashboard/src/jobs/transactions.ts +++ b/apps/dashboard/src/jobs/transactions.ts @@ -4,6 +4,7 @@ import { Database } from "@midday/supabase/src/types"; import { eventTrigger } from "@trigger.dev/sdk"; import { Supabase, SupabaseManagement } from "@trigger.dev/supabase"; import { capitalCase } from "change-case"; +import { revalidateTag } from "next/cache"; import { z } from "zod"; const mapTransactionMethod = (method: string) => { @@ -61,7 +62,6 @@ client.defineJob({ id: "bank-account-created", name: "Bank Account Created", version: "1.0.0", - enabled: false, trigger: supabaseTriggers.onInserted({ table: "bank_accounts", }), @@ -92,7 +92,6 @@ client.defineJob({ name: "Transactions - Latest Transactions", version: "1.0.0", trigger: dynamicSchedule, - enabled: false, integrations: { supabase }, run: async (_, io, ctx) => { const { data } = await io.supabase.client @@ -127,6 +126,12 @@ client.defineJob({ ) .select(); + if (transactionsData?.length && transactionsData.length > 0) { + revalidateTag(`transactions_${data?.team_id}`); + revalidateTag(`spending_${data?.team_id}`); + revalidateTag(`metrics_${data?.team_id}`); + } + if (error) { await io.logger.error(JSON.stringify(error, null, 2)); } @@ -139,7 +144,6 @@ client.defineJob({ id: "transactions-initial-sync", name: "Transactions - Initial", version: "1.0.0", - enabled: false, trigger: eventTrigger({ name: "transactions.initial.sync", schema: z.object({ @@ -168,6 +172,12 @@ client.defineJob({ ) .select(); + if (transactionsData?.length && transactionsData.length > 0) { + revalidateTag(`transactions_${teamId}`); + revalidateTag(`spending_${teamId}`); + revalidateTag(`metrics_${teamId}`); + } + if (error) { await io.logger.error(JSON.stringify(error, null, 2)); } diff --git a/apps/dashboard/src/styles/globals.css b/apps/dashboard/src/styles/globals.css index c9e841e6d6..4f653a479e 100644 --- a/apps/dashboard/src/styles/globals.css +++ b/apps/dashboard/src/styles/globals.css @@ -1,7 +1,6 @@ html, body { height: 100%; - overscroll-behavior: none; } *:focus {