From 7e349c9db167137debf155e4f2bfe5652f639e1a Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 17 Aug 2023 23:14:02 +0200 Subject: [PATCH] perf: Do not load state to calculate navigation node --- server/models/Document.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index 230ec4c1c..99e5ea707 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -767,11 +767,12 @@ class Document extends ParanoidModel { * @param options Optional transaction to use for the query * @returns Promise resolving to a NavigationNode */ - toNavigationNode = async (options?: { - transaction?: Transaction | null | undefined; - }): Promise => { + toNavigationNode = async ( + options?: FindOptions + ): Promise => { const childDocuments = await (this.constructor as typeof Document) .unscoped() + .scope("withoutState") .findAll({ where: { teamId: this.teamId,