Skip to content

Commit

Permalink
fix: Cannot read properties of undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
farnabaz committed Aug 29, 2023
1 parent 8d4a479 commit 11c3b09
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/runtime/query/match/pipeline-legacy.ts
Expand Up @@ -11,17 +11,17 @@ export function createPipelineFetcherLegacy<T> (getContentsList: () => Promise<T

if (params.surround) {
// @ts-ignore
return result.surround
return result?.surround
}

if ((result as any).dirConfig) {
if ((result as any)?.dirConfig) {
result.result = {
_path: (result as any).dirConfig?._path,
...(result.result as T),
_dir: (result as any).dirConfig
}
}

return result.result as T | T[]
return result?.result as T | T[]
}
}
2 changes: 1 addition & 1 deletion src/runtime/query/query.ts
Expand Up @@ -35,7 +35,7 @@ export function createQuery <T = ParsedContent> (fetcher: ContentQueryFetcher<T>
return result.surround
}

if ((result as any).dirConfig) {
if ((result as any)?.dirConfig) {
result.result = {
_path: (result as any).dirConfig?._path,
...(result.result as T),
Expand Down

0 comments on commit 11c3b09

Please sign in to comment.