Skip to content

Commit

Permalink
fix: apply definePage in named pages
Browse files Browse the repository at this point in the history
Fix #383
  • Loading branch information
posva committed May 20, 2024
1 parent 3afe293 commit bd7d5b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function createRoutesContext(options: ResolvedOptions) {
async function writeRouteInfoToNode(node: TreeNode, filePath: string) {
const content = await fs.readFile(filePath, 'utf8')
// TODO: cache the result of parsing the SFC so the transform can reuse the parsing
node.hasDefinePage = content.includes('definePage')
node.hasDefinePage ||= content.includes('definePage')
const [definedPageNameAndPath, routeBlock] = await Promise.all([
extractDefinePageNameAndPath(content, filePath),
getRouteBlock(filePath, options),
Expand Down
1 change: 1 addition & 0 deletions src/core/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export class TreeNode {
*/
options: TreeNodeOptions

// FIXME: refactor this code. It currently helps to keep track if a page has at least one component with `definePage()` but it doesn't tell which. It should keep track of which one while still caching the result per file.
/**
* Should this page import the page info
*/
Expand Down

0 comments on commit bd7d5b1

Please sign in to comment.