Skip to content

Commit

Permalink
fix(interface-tester): fix pages dir resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
matej21 committed Dec 11, 2023
1 parent 0989d8b commit 8501f1b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions packages/interface-tester/src/nodes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Children, isValidElement, ReactNode } from 'react'
import { Children, Fragment, isValidElement, ReactNode } from 'react'

import {
CreatePage,
Expand Down Expand Up @@ -35,15 +35,15 @@ export const createNode = (value: any): ReactNode[] => {

const props = value.props as any
if (value.type === DataBindingProvider) {
return [<>{props.children}</>]
return [<Fragment key="_">{props.children}</Fragment>]
} else if (value.type === EditPage || value.type === EditScope || value.type === DetailPage || value.type === DetailScope) {
return [<EntitySubTree {...props as any} />]
return [<EntitySubTree key="_" {...props as any} />]
} else if (value.type === CreatePage || value.type === CreateScope) {
return [<EntitySubTree {...props as any} isCreating />]
return [<EntitySubTree key="_" {...props as any} isCreating />]
} else if (value.type === DataGridPage || value.type === DataGrid || value.type === DataGridScope) {
return [<DataGrid {...props as any} />]
return [<DataGrid key="_" {...props as any} />]
} else if (value.type === ListPage || value.type === ListScope || value.type === TablePage || value.type === MultiEditPage || value.type === MultiEditScope) {
return [<EntityListSubTree {...props as any} />]
return [<EntityListSubTree key="_" {...props as any} />]
} else if (value.type === GenericPage || value.type === Symbol.for('react.fragment')) {
return (Array.isArray(props.children) ? props.children : [props.children]).map(createNode).flat()
}
Expand Down
2 changes: 1 addition & 1 deletion packages/interface-tester/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const getTests = async (config: Config): Promise<Test[]> => {
let pageBaseDir
const possibleDirs = config.pagesDir ? [config.pagesDir] : ['pages', 'admin/pages']
for (const candidateDir of possibleDirs) {
const tmpBaseDir = join(process.cwd(), config.pagesDir ?? 'pages')
const tmpBaseDir = join(process.cwd(), candidateDir)
if (await pathExists(tmpBaseDir)) {
pageBaseDir = tmpBaseDir
}
Expand Down

0 comments on commit 8501f1b

Please sign in to comment.