diff --git a/packages/react-dataview/src/internal/helpers/staticAnalyzer.tsx b/packages/react-dataview/src/internal/helpers/staticAnalyzer.tsx index 66db4549e..63d520707 100644 --- a/packages/react-dataview/src/internal/helpers/staticAnalyzer.tsx +++ b/packages/react-dataview/src/internal/helpers/staticAnalyzer.tsx @@ -27,7 +27,7 @@ export const collectStaticInfo = (props: DataViewProps, env: Environment): DataV const createDataViewReactNode = (props: DataViewProps, env: Environment) => { const selectionState = props.initialSelection && typeof props.initialSelection !== 'function' ? props.initialSelection : {} const envWithSelectionState = env.withExtension(dataViewSelectionEnvironmentExtension, selectionState) - const entityListSubTree = {props.children} + const entityListSubTree = {props.children} return [entityListSubTree, envWithSelectionState] as const } @@ -39,7 +39,11 @@ const getQueryField = (props: DataViewProps, env: Environment) => { const [node, envWithSelectionState] = createDataViewReactNode(props, env) const markerTreeGenerator = new MarkerTreeGenerator(node, envWithSelectionState) const markerTree = markerTreeGenerator.generate() - const marker = Array.from(markerTree.subTrees.values())[0] + const placeholder = markerTree.placeholdersByAliases.get('__dataview_static') + if (!placeholder) { + throw new Error() + } + const marker = markerTree.subTrees.get(placeholder) if (!(marker instanceof EntityListSubTreeMarker)) { throw new Error() }