Skip to content

Commit

Permalink
fix: demo
Browse files Browse the repository at this point in the history
  • Loading branch information
psteinroe committed Jul 4, 2023
1 parent 494d045 commit e0b388c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useUpsertMutation } from "@supabase-cache-helpers/postgrest-react-query
import { useSupabaseClient } from "@supabase/auth-helpers-react"
import { Loader2 } from "lucide-react"
import { Controller, useForm } from "react-hook-form"
import { v4 as uuid } from "uuid"
import { z } from "zod"

import { Database } from "@/types/database"
Expand Down Expand Up @@ -69,7 +70,7 @@ export const UpsertContactModal: FC<UpsertContactModalProps> = ({
const onSubmitHandler = useCallback<FormEventHandler<HTMLFormElement>>(
(e) => {
handleSubmit(async (data) => {
await upsert([data])
await upsert([{ ...data, id: data.id ?? uuid() }])
})(e)
},
[handleSubmit, upsert]
Expand Down
2 changes: 2 additions & 0 deletions examples/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@
"sharp": "^0.31.3",
"tailwind-merge": "^1.8.0",
"tailwindcss-animate": "^1.0.5",
"uuid": "^9.0.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.1",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"@types/uuid": "^9.0.2",
"autoprefixer": "^10.4.13",
"dotenv": "16.0.1",
"eslint": "^8.31.0",
Expand Down
3 changes: 2 additions & 1 deletion examples/swr/components/contact/upsert-contact.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useUpsertMutation } from "@supabase-cache-helpers/postgrest-swr"
import { useSupabaseClient } from "@supabase/auth-helpers-react"
import { Loader2 } from "lucide-react"
import { Controller, useForm } from "react-hook-form"
import { v4 as uuid } from "uuid"
import { z } from "zod"

import { Database } from "@/types/database"
Expand Down Expand Up @@ -69,7 +70,7 @@ export const UpsertContactModal: FC<UpsertContactModalProps> = ({
const onSubmitHandler = useCallback<FormEventHandler<HTMLFormElement>>(
(e) => {
handleSubmit(async (data) => {
await upsert([data])
await upsert([{ ...data, id: data.id ?? uuid() }])
})(e)
},
[handleSubmit, upsert]
Expand Down
3 changes: 3 additions & 0 deletions examples/swr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@supabase-cache-helpers/storage-swr": "workspace:*",
"@supabase/auth-helpers-nextjs": "^0.5.6",
"@supabase/auth-helpers-react": "^0.3.1",
"@supabase/supabase-js": "2.26.0",
"@vercel/analytics": "^0.1.11",
"class-variance-authority": "^0.4.0",
"clsx": "^1.2.1",
Expand All @@ -61,13 +62,15 @@
"swr": "^2.1.5",
"tailwind-merge": "^1.8.0",
"tailwindcss-animate": "^1.0.5",
"uuid": "^9.0.0",
"zod": "^3.21.4"
},
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^3.7.1",
"@types/node": "^17.0.12",
"@types/react": "^18.0.22",
"@types/react-dom": "^18.0.7",
"@types/uuid": "^9.0.2",
"autoprefixer": "^10.4.13",
"dotenv": "16.0.1",
"eslint": "^8.31.0",
Expand Down
22 changes: 20 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 comments on commit e0b388c

@vercel
Copy link

@vercel vercel bot commented on e0b388c Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

supabase-cache-helpers-react-query – ./examples/react-query

supabase-cache-helpers-react-query.vercel.app
supabase-cache-helpers-react-query-psteinroe.vercel.app
supabase-cache-helpers-react-query-git-main-psteinroe.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e0b388c Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

supabase-cache-helpers-swr-demo – ./examples/swr

supabase-cache-helpers-swr.vercel.app
supabase-cache-helpers-swr-demo-git-main-psteinroe.vercel.app
supabase-cache-helpers-swr-demo-psteinroe.vercel.app

@vercel
Copy link

@vercel vercel bot commented on e0b388c Jul 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.