Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hydration warnings with DOM diff in react-reconciler (#10085) #13602

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions fixtures/ssr/server/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ if (process.env.NODE_ENV === 'development') {
assets = require('../build/asset-manifest.json');
}

export default function render() {
var html = renderToString(<App assets={assets} />);
export default function render(url) {
var html = renderToString(<App assets={assets} url={url} />);
// There's no way to render a doctype in React so prepend manually.
// Also append a bootstrap script tag.
return '<!DOCTYPE html>' + html;
Expand Down
6 changes: 5 additions & 1 deletion fixtures/ssr/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import Chrome from './Chrome';
import Page from './Page';
import Page2 from './Page2';
import Theme from './Theme';
import SSRMismatchTest from './SSRMismatchTest';

function LoadingIndicator() {
let theme = useContext(Theme);
return <div className={theme + '-loading'}>Loading...</div>;
}

export default function App({assets}) {
export default function App({assets, url}) {
let [CurrentPage, switchPage] = useState(() => Page);
return (
<Chrome title="Hello World" assets={assets}>
Expand All @@ -27,6 +28,9 @@ export default function App({assets}) {
<CurrentPage />
</Suspense>
</div>
<div>
<SSRMismatchTest url={url} />
</div>
</Chrome>
);
}
Loading