某些情况下渲染空页面而非crash

在以下以及更多类似情况下会导致页面crash:

哪些情况会导致渲染崩掉?
一
render(
    {
        ...
        hidden: 'no falsy'
    },
    props,
    env,
    pathPrefix?
)

render(
    {
        ...
        visible:  false
    },
    props,
    env,
    pathPrefix?
)

二

render(
    schema,
    {
        ...
        hidden: 'no falsy'
    },
    env,
    pathPrefix?
)

render(
    schema,
    {
        ...
        visible:  false
    },
    env,
    pathPrefix?
)

三

render(
    schema,
    {
        data: {
            ...
            visible:  false
        }
    },
    env,
    pathPrefix?
)

render(
    schema,
    {
        data: {
            ...
            hidden: 'no falsy'
        }
    },
    env,
    pathPrefix?
)


四

render(
    {
        ...
        hiddenOn: '1'
    },
    props,
    env,
    pathPrefix?
)

render(
    {
        ...
        visibleOn: '0'
    },
    props,
    env,
    pathPrefix?
)


render(
    {
        ...
        "hiddenExpr": "no falsy string",
    },
    props,
    env,
    pathPrefix?
)
This commit is contained in:
DuLinRain 2020-07-24 02:21:54 +08:00 committed by GitHub
parent afb8b75ad7
commit 08f7bf21d5
1 changed files with 1 additions and 1 deletions

View File

@ -304,7 +304,7 @@ export function renderChild(
props.hidden ||
props.visible === false)
) {
return null;
return (<></>);
}
const transform = props.propsTransform;