perf: Do not load state to calculate navigation node

This commit is contained in:
Tom Moor
2023-08-17 23:14:02 +02:00
parent 13b067fb3f
commit 7e349c9db1

View File

@@ -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<NavigationNode> => {
toNavigationNode = async (
options?: FindOptions<Document>
): Promise<NavigationNode> => {
const childDocuments = await (this.constructor as typeof Document)
.unscoped()
.scope("withoutState")
.findAll({
where: {
teamId: this.teamId,