From f36e18e3a6f81afd437be950fd3063550b2a3c11 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 10 Mar 2022 09:17:29 -0800 Subject: [PATCH] perf: Document.state still queried in documents.search endpoint --- server/models/Document.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/models/Document.ts b/server/models/Document.ts index cca01e9f5..28b877fcd 100644 --- a/server/models/Document.ts +++ b/server/models/Document.ts @@ -610,7 +610,8 @@ class Document extends ParanoidModel { // Final query to get associated document data const documents = await this.scope([ - "defaultScope", + "withoutState", + "withDrafts", { method: ["withViews", user.id], },