dillon1000/react
Commit
Browse files Ignore SSR warning using explicit suppressHydrationWarning option (#11126)
* Pass parent type and props to insert/delete hydration warning hooks For this to work, we need to split the API into a container and normal version. Since the root doesn't have a type nor props. * Ignore SSR warning using explicit suppressHydrationWarning option This lets you ignore the warning on a single element and its direct child content. This is useful for simple fields that you're expecting to fail such as time stamps. Note that this still won't patch up such content so it'll remain inconsistent. It's also not suitable for nested complex content that may change. * Suppress warning of inserted/deleted direct children * Add fixture testing hydration warning Also fixing the render->hydrate API change in the fixture * Add hooks when text hydration doesn't match up The purpose of these hooks is to pass the parent context to them. I don't want to do that in the normal hydrateTextInstance hooks since this is only used in DEV. This is also in line with what happens if there is no text instance at all and we invoke didNotFindHydratableTextInstance. * Move mismatch text hydration warning to the new hooks This lets us ignore this call when we have parent props available and the suppression flag is set.
Changed paths11 files
First-parent comparisonfixtures/ssr/src/components/Page.js ModifiedM fixtures/ssr/src/index.js ModifiedM src/renderers/dom/fiber/ReactDOMFiberComponent.js ModifiedM src/renderers/dom/fiber/ReactDOMFiberEntry.js ModifiedM src/renderers/dom/shared/DOMProperty.js ModifiedM src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js ModifiedM src/renderers/dom/shared/__tests__/ReactDOMServerIntegration-test.js ModifiedM src/renderers/dom/shared/hooks/possibleStandardNames.js ModifiedM src/renderers/shared/fiber/ReactFiberHydrationContext.js ModifiedM src/renderers/shared/fiber/ReactFiberReconciler.js ModifiedM src/renderers/shared/server/ReactPartialRenderer.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…