diff --git a/package-lock.json b/package-lock.json index a8e729a..8c062ae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "clsx": "^2.0.0", "lucide-react": "^0.290.0", "nanoid": "^5.0.4", - "next": "^14.0.5-canary.12", + "next": "^14.0.1", "next-plausible": "^3.12.0", "next-themes": "^0.2.1", "next13-progressbar": "^1.1.1", @@ -280,9 +280,9 @@ } }, "node_modules/@next/env": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.5-canary.12.tgz", - "integrity": "sha512-YzePdvd+GcrANTHqDkoNx97YN7EYUGAUrEt4F+h30wD8MEW+QM4EhAHxL3JOUTSkSF0zmwrTyTtSvlGdlqUQiA==" + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.0.1.tgz", + "integrity": "sha512-Ms8ZswqY65/YfcjrlcIwMPD7Rg/dVjdLapMcSHG26W6O67EJDF435ShW4H4LXi1xKO1oRc97tLXUpx8jpLe86A==" }, "node_modules/@next/eslint-plugin-next": { "version": "14.0.4", @@ -314,9 +314,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.5-canary.12.tgz", - "integrity": "sha512-MQtCDCP/A4VOuHfTUjZMaSxBwJj5/K+l7ww+W5apI7KutJjtdbAxli1FF6kbgVQST47mdn2mHDsMGhBmt3sjpg==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.0.1.tgz", + "integrity": "sha512-JyxnGCS4qT67hdOKQ0CkgFTp+PXub5W1wsGvIq98TNbF3YEIN7iDekYhYsZzc8Ov0pWEsghQt+tANdidITCLaw==", "cpu": [ "arm64" ], @@ -329,9 +329,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.5-canary.12.tgz", - "integrity": "sha512-H482SA2gpel5FpJDEE2W/L+ZHHcNg1a6tIzluzTmCJ7OTFMgU8/SifGORHHKjKk2eH3oDmbKn8ClXs9UBYQClA==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.0.1.tgz", + "integrity": "sha512-625Z7bb5AyIzswF9hvfZWa+HTwFZw+Jn3lOBNZB87lUS0iuCYDHqk3ujuHCkiyPtSC0xFBtYDLcrZ11mF/ap3w==", "cpu": [ "x64" ], @@ -344,9 +344,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.5-canary.12.tgz", - "integrity": "sha512-Wuyg36CDBFFrWO8gctSHdGQym7f4hSK5cLJxsPjvvzP+tXL4YVR8Gw7Za+mqJFEWmZ8OQRWwp4ZWgLt5GaRsyg==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.0.1.tgz", + "integrity": "sha512-iVpn3KG3DprFXzVHM09kvb//4CNNXBQ9NB/pTm8LO+vnnnaObnzFdS5KM+w1okwa32xH0g8EvZIhoB3fI3mS1g==", "cpu": [ "arm64" ], @@ -359,9 +359,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.5-canary.12.tgz", - "integrity": "sha512-rL+vKUcp8NWv19wQ6VqoQiWKtXc4Eztm1SoD1cjtuyNb1D0tllNADxubvkdzu25VXlolwjJvA6OXAmOZW1NTpw==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.0.1.tgz", + "integrity": "sha512-mVsGyMxTLWZXyD5sen6kGOTYVOO67lZjLApIj/JsTEEohDDt1im2nkspzfV5MvhfS7diDw6Rp/xvAQaWZTv1Ww==", "cpu": [ "arm64" ], @@ -374,9 +374,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.5-canary.12.tgz", - "integrity": "sha512-hT3XMWZbaArw5/Ri9DyWqXt4hhxsJgAg1QajDnm98uWBQrBWuganRFpmm8VahpNjEIt+qkzQ1c+A8BdQnyQ8+A==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.0.1.tgz", + "integrity": "sha512-wMqf90uDWN001NqCM/auRl3+qVVeKfjJdT9XW+RMIOf+rhUzadmYJu++tp2y+hUbb6GTRhT+VjQzcgg/QTD9NQ==", "cpu": [ "x64" ], @@ -389,9 +389,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.5-canary.12.tgz", - "integrity": "sha512-Z5x1WbyG/oqKaWbpVTCJW+SdB9GQLeC6y1Bmzwzw2P0LY4fzKtho8f+/8iB+cXzpMA0vfj2DWMs7CBgHfbCFpw==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.0.1.tgz", + "integrity": "sha512-ol1X1e24w4j4QwdeNjfX0f+Nza25n+ymY0T2frTyalVczUmzkVD7QGgPTZMHfR1aLrO69hBs0G3QBYaj22J5GQ==", "cpu": [ "x64" ], @@ -404,9 +404,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.5-canary.12.tgz", - "integrity": "sha512-biqb28j9VJUaLKBtGFzbRjpaLWcp/SYCxRmoaK2VZZ97Kycpwp4wKaa8R9gFF+uHq0eqG27LN/NQ6PwuHc+TXQ==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.0.1.tgz", + "integrity": "sha512-WEmTEeWs6yRUEnUlahTgvZteh5RJc4sEjCQIodJlZZ5/VJwVP8p2L7l6VhzQhT4h7KvLx/Ed4UViBdne6zpIsw==", "cpu": [ "arm64" ], @@ -419,9 +419,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.5-canary.12.tgz", - "integrity": "sha512-vfvcqfPms3/yoaWhSEQfCsMjtymPEiiaciIo1C263deJOIstZBKuuPe5wv4QnccHoK02i74vjNl5zN1bNJ/eWw==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.0.1.tgz", + "integrity": "sha512-oFpHphN4ygAgZUKjzga7SoH2VGbEJXZa/KL8bHCAwCjDWle6R1SpiGOdUdA8EJ9YsG1TYWpzY6FTbUA+iAJeww==", "cpu": [ "ia32" ], @@ -434,9 +434,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.5-canary.12.tgz", - "integrity": "sha512-39FcDa/pP7fXL17PB9hIcbMNsfr1ew5RwvZEtKy1+qmuqXA/sApZt3Kbm3D/ggWP/bfHVRhfq5QKp8X4trADjw==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.0.1.tgz", + "integrity": "sha512-FFp3nOJ/5qSpeWT0BZQ+YE1pSMk4IMpkME/1DwKBwhg4mJLB9L+6EXuJi4JEwaJdl5iN+UUlmUD3IsR1kx5fAg==", "cpu": [ "x64" ], @@ -4235,15 +4235,14 @@ "license": "MIT" }, "node_modules/next": { - "version": "14.0.5-canary.12", - "resolved": "https://registry.npmjs.org/next/-/next-14.0.5-canary.12.tgz", - "integrity": "sha512-+w3vbb8VRFvDM8NxB5XkqkOmS+Ox9zCi6P+Ww+oolsM5TLMxA8t0sh4y+BETEpFjdwq8BgewFIBk9tudvz5xkA==", + "version": "14.0.1", + "resolved": "https://registry.npmjs.org/next/-/next-14.0.1.tgz", + "integrity": "sha512-s4YaLpE4b0gmb3ggtmpmV+wt+lPRuGtANzojMQ2+gmBpgX9w5fTbjsy6dXByBuENsdCX5pukZH/GxdFgO62+pA==", "dependencies": { - "@next/env": "14.0.5-canary.12", + "@next/env": "14.0.1", "@swc/helpers": "0.5.2", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001406", - "graceful-fs": "^4.2.11", "postcss": "8.4.31", "styled-jsx": "5.1.1", "watchpack": "2.4.0" @@ -4255,15 +4254,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.0.5-canary.12", - "@next/swc-darwin-x64": "14.0.5-canary.12", - "@next/swc-linux-arm64-gnu": "14.0.5-canary.12", - "@next/swc-linux-arm64-musl": "14.0.5-canary.12", - "@next/swc-linux-x64-gnu": "14.0.5-canary.12", - "@next/swc-linux-x64-musl": "14.0.5-canary.12", - "@next/swc-win32-arm64-msvc": "14.0.5-canary.12", - "@next/swc-win32-ia32-msvc": "14.0.5-canary.12", - "@next/swc-win32-x64-msvc": "14.0.5-canary.12" + "@next/swc-darwin-arm64": "14.0.1", + "@next/swc-darwin-x64": "14.0.1", + "@next/swc-linux-arm64-gnu": "14.0.1", + "@next/swc-linux-arm64-musl": "14.0.1", + "@next/swc-linux-x64-gnu": "14.0.1", + "@next/swc-linux-x64-musl": "14.0.1", + "@next/swc-win32-arm64-msvc": "14.0.1", + "@next/swc-win32-ia32-msvc": "14.0.1", + "@next/swc-win32-x64-msvc": "14.0.1" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", diff --git a/package.json b/package.json index 8bf0202..7a4ee22 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "clsx": "^2.0.0", "lucide-react": "^0.290.0", "nanoid": "^5.0.4", - "next": "^14.0.5-canary.12", + "next": "^14.0.1", "next-plausible": "^3.12.0", "next-themes": "^0.2.1", "next13-progressbar": "^1.1.1", diff --git a/src/app/groups/[groupId]/@modal/expense-modal.tsx b/src/app/groups/[groupId]/@modal/expense-modal.tsx index 1470ef2..587af39 100644 --- a/src/app/groups/[groupId]/@modal/expense-modal.tsx +++ b/src/app/groups/[groupId]/@modal/expense-modal.tsx @@ -6,7 +6,7 @@ import { DialogTitle, } from '@/components/ui/dialog' import { useRouter } from 'next/navigation' -import { ReactNode } from 'react' +import { ReactNode, useState } from 'react' export function ExpenseModal({ children, @@ -16,9 +16,16 @@ export function ExpenseModal({ title: ReactNode }) { const router = useRouter() + const [open, setOpen] = useState(true) return ( - router.back()}> + { + setOpen(open) + if (!open) router.back() + }} + > {title} diff --git a/src/app/groups/[groupId]/expenses/actions.ts b/src/app/groups/[groupId]/expenses/actions.ts index f39e477..31bb2e7 100644 --- a/src/app/groups/[groupId]/expenses/actions.ts +++ b/src/app/groups/[groupId]/expenses/actions.ts @@ -1,13 +1,13 @@ 'use server' import { createExpense, deleteExpense, updateExpense } from '@/lib/api' import { expenseFormSchema } from '@/lib/schemas' -import { redirect } from 'next/navigation' +import { revalidatePath } from 'next/cache' export async function createExpenseAction(groupId: string, values: unknown) { 'use server' const expenseFormValues = expenseFormSchema.parse(values) await createExpense(expenseFormValues, groupId) - redirect(`/groups/${groupId}`) + revalidatePath(`/groups/${groupId}`, 'layout') } export async function updateExpenseAction( @@ -18,11 +18,11 @@ export async function updateExpenseAction( 'use server' const expenseFormValues = expenseFormSchema.parse(values) await updateExpense(groupId, expenseId, expenseFormValues) - redirect(`/groups/${groupId}`) + revalidatePath(`/groups/${groupId}`, 'layout') } export async function deleteExpenseAction(groupId: string, expenseId: string) { 'use server' await deleteExpense(expenseId) - redirect(`/groups/${groupId}`) + revalidatePath(`/groups/${groupId}`, 'layout') } diff --git a/src/app/groups/[groupId]/not-found.tsx b/src/app/groups/[groupId]/not-found.tsx index bb00545..af3788b 100644 --- a/src/app/groups/[groupId]/not-found.tsx +++ b/src/app/groups/[groupId]/not-found.tsx @@ -1,8 +1,5 @@ 'use client' -import { redirect, useParams } from 'next/navigation' export default function NotFound() { - const { groupId } = useParams() - console.log('Not found!', { groupId }) - redirect(`/groups/${groupId}`) + return null } diff --git a/src/app/groups/[groupId]/reimbursement-list.tsx b/src/app/groups/[groupId]/reimbursement-list.tsx index 54ee9d7..1153b59 100644 --- a/src/app/groups/[groupId]/reimbursement-list.tsx +++ b/src/app/groups/[groupId]/reimbursement-list.tsx @@ -37,6 +37,7 @@ export function ReimbursementList({