import { useMemo } from "react" ; import { BuilderRuntimeNode } from "../interfaces" ; export function useCanvasList ( rootChildNodes ) { return useMemo ( ( ) => { const mainCanvas = [ ] ; const portalCanvasList = [ ] ; for ( const child of rootChildNodes ) { if ( child . portal ) { portalCanvasList . push ( [ child ] ) ; } else { mainCanvas . push ( child ) ; } } return [ mainCanvas , ... portalCanvasList , [ ] ] ; } , [ rootChildNodes ] ) ; }