perf: memo GridCard, fuse save fns, fix slash tab active color
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m32s
CI / Deploy production (on server) (push) Has been skipped

This commit is contained in:
Antigravity
2026-06-14 14:06:05 +00:00
parent a8785ed4f1
commit a623454347
120 changed files with 12301 additions and 785 deletions

View File

@@ -22,6 +22,10 @@ import {
} from '@/lib/note-history'
import { NOTE_LIST_SELECT } from '@/lib/note-select'
function stripNullBytes(str: string | null | undefined): string | null {
if (str === null || str === undefined) return null
return str.replace(/\u0000/g, '')
}
async function ensureSessionUserExists(sessionUser: { id: string; email?: string | null; name?: string | null }) {
const fallbackEmail = `user-${sessionUser.id}@local.momento`
@@ -400,8 +404,8 @@ export async function createNote(data: {
const note = await prisma.note.create({
data: {
userId: session.user.id,
title: data.title || null,
content: data.content,
title: stripNullBytes(data.title) || null,
content: stripNullBytes(data.content) || '',
color: data.color || 'default',
type: data.type || 'richtext',
checkItems: data.checkItems ? JSON.stringify(data.checkItems) : null,
@@ -563,6 +567,12 @@ export async function updateNote(id: string, data: {
const oldNotebookId = oldNote?.notebookId
const updateData: any = { ...data }
if (updateData.title !== undefined) {
updateData.title = stripNullBytes(updateData.title)
}
if (updateData.content !== undefined) {
updateData.content = stripNullBytes(updateData.content)
}
// Reset isReminderDone only when reminder date actually changes (not on every save)
if ('reminder' in data && data.reminder !== null) {
@@ -984,6 +994,7 @@ export async function getAllNotes(includeArchived = false, notebookId?: string)
const sharedNotes = acceptedShares
.map(share => share.note)
.filter(Boolean)
.filter(note => includeArchived || !note.isArchived)
.map(note => ({ ...note, _isShared: true }))