mirror of
https://github.com/facebook/react.git
synced 2026-02-25 22:25:09 +00:00
* Don't invoke listeners on parent of dehydrated event target * Move Suspense boundary check to getClosestInstanceFromNode Now getClosestInstanceFromNode can return either a host component, host text component or suspense component when the suspense component is dehydrated. We then use that to ignore events on a suspense component. * Attach the HostRoot fiber to the DOM container This lets us detect if an event happens on this root's subtree before it has rendered something. * Add todo The approach of checking isFiberMounted answers if we might be in an in-progress hydration but it doesn't answer which root or boundary might be in-progress so we don't know what to wait for. This needs some refactoring. * Refactor isFiberMountedImpl to getNearestMountedFiber We'll need the nearest boundary for event replaying so this prepares for that. This surfaced an issue that we attach Hydrating tag on the root but normally this (and Placement) is attached on the child. This surfaced an issue that this can lead to both Placement and Hydrating effects which is not supported so we need to ensure that we only ever use one or the other. * Add todo for bug I spotted * Cache tags * Check the ContainerInstanceKey before the InstanceKey The container is inside the instance, so we must find it before the instance, since otherwise we'll miss it.
51 lines
1.8 KiB
JavaScript
51 lines
1.8 KiB
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
import invariant from 'shared/invariant';
|
|
|
|
// Renderers that don't support hydration
|
|
// can re-export everything from this module.
|
|
|
|
function shim(...args: any) {
|
|
invariant(
|
|
false,
|
|
'The current renderer does not support hydration. ' +
|
|
'This error is likely caused by a bug in React. ' +
|
|
'Please file an issue.',
|
|
);
|
|
}
|
|
|
|
// Hydration (when unsupported)
|
|
export type SuspenseInstance = mixed;
|
|
export const supportsHydration = false;
|
|
export const canHydrateInstance = shim;
|
|
export const canHydrateTextInstance = shim;
|
|
export const canHydrateSuspenseInstance = shim;
|
|
export const isSuspenseInstancePending = shim;
|
|
export const isSuspenseInstanceFallback = shim;
|
|
export const registerSuspenseInstanceRetry = shim;
|
|
export const getNextHydratableSibling = shim;
|
|
export const getFirstHydratableChild = shim;
|
|
export const hydrateInstance = shim;
|
|
export const hydrateTextInstance = shim;
|
|
export const hydrateSuspenseInstance = shim;
|
|
export const getNextHydratableInstanceAfterSuspenseInstance = shim;
|
|
export const clearSuspenseBoundary = shim;
|
|
export const clearSuspenseBoundaryFromContainer = shim;
|
|
export const didNotMatchHydratedContainerTextInstance = shim;
|
|
export const didNotMatchHydratedTextInstance = shim;
|
|
export const didNotHydrateContainerInstance = shim;
|
|
export const didNotHydrateInstance = shim;
|
|
export const didNotFindHydratableContainerInstance = shim;
|
|
export const didNotFindHydratableContainerTextInstance = shim;
|
|
export const didNotFindHydratableContainerSuspenseInstance = shim;
|
|
export const didNotFindHydratableInstance = shim;
|
|
export const didNotFindHydratableTextInstance = shim;
|
|
export const didNotFindHydratableSuspenseInstance = shim;
|