diff --git a/src/renderers/Dialog.tsx b/src/renderers/Dialog.tsx index c9d853a90..e82760fed 100644 --- a/src/renderers/Dialog.tsx +++ b/src/renderers/Dialog.tsx @@ -652,15 +652,15 @@ export class DialogRenderer extends Dialog { const pool = components.concat(); while (pool.length) { - const item = pool.shift()!; + const item = pool.pop()!; - if (~['drawer', 'dialog'].indexOf(item.props.type)) { - continue; - } else if (~['page', 'service'].indexOf(item.props.type)) { - pool.push.apply(pool, item.context.getComponents()); - } else if (~['crud', 'form', 'wizard'].indexOf(item.props.type)) { + if (~['crud', 'form', 'wizard'].indexOf(item.props.type)) { targets.push(item); break; + } else if (~['drawer', 'dialog'].indexOf(item.props.type)) { + continue; + } else if (~['page', 'service'].indexOf(item.props.type)) { + pool.unshift.apply(pool, item.context.getComponents()); } } } diff --git a/src/renderers/Drawer.tsx b/src/renderers/Drawer.tsx index e0675c515..5e850c43f 100644 --- a/src/renderers/Drawer.tsx +++ b/src/renderers/Drawer.tsx @@ -710,15 +710,15 @@ export class DrawerRenderer extends Drawer { const pool = components.concat(); while (pool.length) { - const item = pool.shift()!; + const item = pool.pop()!; - if (~['drawer', 'dialog'].indexOf(item.props.type)) { - continue; - } else if (~['page', 'service'].indexOf(item.props.type)) { - pool.push.apply(pool, item.context.getComponents()); - } else if (~['crud', 'form', 'wizard'].indexOf(item.props.type)) { + if (~['crud', 'form', 'wizard'].indexOf(item.props.type)) { targets.push(item); break; + } else if (~['drawer', 'dialog'].indexOf(item.props.type)) { + continue; + } else if (~['page', 'service'].indexOf(item.props.type)) { + pool.unshift.apply(pool, item.context.getComponents()); } } }