chore: snapshot before performance optimization

This commit is contained in:
Sepehr Ramezani
2026-04-17 21:14:43 +02:00
parent b6a548acd8
commit 2eceb32fd4
95 changed files with 4357 additions and 1942 deletions

View File

@@ -1,7 +1,6 @@
import { NextRequest, NextResponse } from 'next/server'
import prisma from '@/lib/prisma'
import { auth } from '@/auth'
import { revalidatePath } from 'next/cache'
import { reconcileLabelsAfterNoteMove } from '@/app/actions/notes'
// POST /api/notes/[id]/move - Move a note to a notebook (or to Inbox)
@@ -77,7 +76,9 @@ export async function POST(
await reconcileLabelsAfterNoteMove(id, targetNotebookId)
revalidatePath('/')
// No revalidatePath('/') here — the client-side triggerRefresh() in
// notebooks-context.tsx handles the refresh. Avoiding server-side
// revalidation prevents a double-refresh (server + client).
return NextResponse.json({
success: true,

View File

@@ -87,10 +87,10 @@ export async function PUT(
const updateData: any = { ...body }
if ('checkItems' in body) {
updateData.checkItems = body.checkItems ? JSON.stringify(body.checkItems) : null
updateData.checkItems = body.checkItems ?? null
}
if ('labels' in body) {
updateData.labels = body.labels ? JSON.stringify(body.labels) : null
updateData.labels = body.labels ?? null
}
updateData.updatedAt = new Date()

View File

@@ -83,9 +83,9 @@ export async function POST(request: NextRequest) {
content: content || '',
color: color || 'default',
type: type || 'text',
checkItems: checkItems ? JSON.stringify(checkItems) : null,
labels: labels ? JSON.stringify(labels) : null,
images: images ? JSON.stringify(images) : null,
checkItems: checkItems ?? null,
labels: labels ?? null,
images: images ?? null,
}
})
@@ -147,11 +147,11 @@ export async function PUT(request: NextRequest) {
if (content !== undefined) updateData.content = content
if (color !== undefined) updateData.color = color
if (type !== undefined) updateData.type = type
if (checkItems !== undefined) updateData.checkItems = checkItems ? JSON.stringify(checkItems) : null
if (labels !== undefined) updateData.labels = labels ? JSON.stringify(labels) : null
if (checkItems !== undefined) updateData.checkItems = checkItems ?? null
if (labels !== undefined) updateData.labels = labels ?? null
if (isPinned !== undefined) updateData.isPinned = isPinned
if (isArchived !== undefined) updateData.isArchived = isArchived
if (images !== undefined) updateData.images = images ? JSON.stringify(images) : null
if (images !== undefined) updateData.images = images ?? null
const note = await prisma.note.update({
where: { id },