We render some markup on the server, but on the client (due to the bug in our app's code) we have a different state and we render nothing (instead of our markup).
In this case React should fallback to client render, so it is expected that the server-rendered markup is removed, but it's not.
Notice, how the server-rendered placeholders are still visible though the console.log inside the component states that the visible state is false:
The problem exists only if this branch happens to be at the very top of the components tree. React doesn't even see the mismatch.
We render some markup on the server, but on the client (due to the bug in our app's code) we have a different state and we render nothing (instead of our markup).
In this case React should fallback to client render, so it is expected that the server-rendered markup is removed, but it's not.
Notice, how the server-rendered placeholders are still visible though the
console.log
inside the component states that the visible state is false:The problem exists only if this branch happens to be at the very top of the components tree. React doesn't even see the mismatch.
React version: 18.2.0
Steps To Reproduce
Link to code example:
https://stackblitz.com/edit/react-kpphvo?file=src/App.js
The current behavior
Mismatch is ignored, client's render result is not applied
The expected behavior
Fallback to client's render result, mismatch warning is reported, server rendered markup is removed