From 34059ce0eff69936e401cac2300c9477fcea3ba3 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 3 Aug 2025 21:52:10 -0400 Subject: [PATCH] chore: More missing transactions (#9811) * fix: Missing transaction in notifications.update_all * lint --- app/routes/index.tsx | 5 +---- server/logging/sentry.ts | 2 +- server/routes/api/notifications/notifications.ts | 4 +++- shared/editor/commands/table.ts | 3 --- shared/editor/plugins/TableLayoutPlugin.ts | 4 ---- 5 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/routes/index.tsx b/app/routes/index.tsx index 73ca88aad0..c4acd1dadd 100644 --- a/app/routes/index.tsx +++ b/app/routes/index.tsx @@ -7,10 +7,7 @@ import Route from "~/components/ProfiledRoute"; import env from "~/env"; import useQueryNotices from "~/hooks/useQueryNotices"; import lazy from "~/utils/lazyWithRetry"; -import { - matchCollectionSlug as collectionSlug, - matchDocumentSlug as documentSlug, -} from "~/utils/routeHelpers"; +import { matchDocumentSlug as documentSlug } from "~/utils/routeHelpers"; const Authenticated = lazy(() => import("~/components/Authenticated")); const AuthenticatedRoutes = lazy(() => import("./authenticated")); diff --git a/server/logging/sentry.ts b/server/logging/sentry.ts index 1943bb7735..7e277f9f1b 100644 --- a/server/logging/sentry.ts +++ b/server/logging/sentry.ts @@ -37,7 +37,7 @@ if (env.SENTRY_DSN) { break; } return event; - } catch (e) { + } catch (_) { return event; } }, diff --git a/server/routes/api/notifications/notifications.ts b/server/routes/api/notifications/notifications.ts index 41b99e5388..10184766db 100644 --- a/server/routes/api/notifications/notifications.ts +++ b/server/routes/api/notifications/notifications.ts @@ -220,9 +220,11 @@ router.post( "notifications.update_all", auth(), validate(T.NotificationsUpdateAllSchema), + transaction(), async (ctx: APIContext) => { const { viewedAt, archivedAt } = ctx.input.body; const { user } = ctx.state.auth; + const { transaction } = ctx.state; const values: Partial = {}; let where: WhereOptions = { @@ -247,7 +249,7 @@ router.post( let total = 0; if (!isEmpty(values)) { total = await Notification.unscoped().findAllInBatches( - { where }, + { where, transaction, lock: transaction.LOCK.UPDATE }, async (results) => { await Promise.all( results.map((notification) => diff --git a/shared/editor/commands/table.ts b/shared/editor/commands/table.ts index 198257b7de..c8645ca2ec 100644 --- a/shared/editor/commands/table.ts +++ b/shared/editor/commands/table.ts @@ -365,9 +365,6 @@ export function addColumnBefore({ index }: { index?: number }): Command { // move inwards. const headerSpecialCase = position === 0 && isHeaderColumnEnabled; - // Determine which column to copy alignment from (using original table indices) - const copyFromColumn = position === 0 ? 0 : position - 1; - chainTransactions( headerSpecialCase ? toggleHeader("column") : undefined, (s, d) => !!d?.(addColumn(s.tr, rect, position)), diff --git a/shared/editor/plugins/TableLayoutPlugin.ts b/shared/editor/plugins/TableLayoutPlugin.ts index cbc2343553..d03b1c2ce9 100644 --- a/shared/editor/plugins/TableLayoutPlugin.ts +++ b/shared/editor/plugins/TableLayoutPlugin.ts @@ -86,10 +86,6 @@ export class TableLayoutPlugin extends Plugin { tr = newState.tr; } - // Get all cells in the last column - const tempState = newState.apply(tr); - const tempSelection = tempState.selection; - // Create a temporary state to use getCellsInColumn const tableStart = pos + 1; const cellPositions: number[] = [];