Hi there! I’m having a weird issue with the F7 React Sheet.
If the sheet is displayed and then the page is updated (via a state change), then the app crashes and a white page is shown.
It’s very easy to reproduce with the following code:
import React, { useEffect, useState } from 'react';
import {
Page,
Block,
Sheet,
PageContent,
f7
} from 'framework7-react';
export default () => {
const [estado, setEstado] = useState(false)
useEffect(() => {
f7.sheet.open("#js-sheet");
setTimeout(() => setEstado(true), 2000)
}, [])
return (
<Page>
{estado &&
<Block>This block should render in two seconds but it crashes this application</Block>
}
{/*
<>
{estado &&
<Block>This block should render in two seconds and it works because it has a parent</Block>
}
</>
*/}
<Sheet id="js-sheet">
<PageContent>
<Block>hola</Block>
</PageContent>
</Sheet>
</Page>
);
};
The error is the following:
Uncaught DOMException: Node.removeChild: The node to be removed is not a child of this node
As a workaround, I found that it works if the updated block is inside a React.Fragment (or any other parent that is not removed from DOM).
Is it a bug in the Sheet component, or am I doing something wrong? Thanks!!