From ebbf6651c9c336f0fbe1063e946ebd9d78d62e6a Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 7 Apr 2025 13:35:13 +0900 Subject: [PATCH] fix: result path is not correct --- packages/frontend/lib/vite-plugin-create-search-index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/frontend/lib/vite-plugin-create-search-index.ts b/packages/frontend/lib/vite-plugin-create-search-index.ts index 19b95a798e..a0a98b2d3e 100644 --- a/packages/frontend/lib/vite-plugin-create-search-index.ts +++ b/packages/frontend/lib/vite-plugin-create-search-index.ts @@ -100,14 +100,15 @@ type WalkVueNode = RootNode | TemplateChildNode | SimpleExpressionNode; */ function walkVueElements(nodes: WalkVueNode[], context: C, callback: (node: ElementNode, context: C) => C | undefined | void | false): void { for (const node of nodes) { + let currentContext = context; if (node.type === NodeTypes.COMPOUND_EXPRESSION) throw new Error("Unexpected COMPOUND_EXPRESSION"); if (node.type === NodeTypes.ELEMENT) { const result = callback(node, context); if (result === false) return; - if (result !== undefined) context = result; + if (result !== undefined) currentContext = result; } if ('children' in node) { - walkVueElements(node.children, context, callback); + walkVueElements(node.children, currentContext, callback); } } }