@@ -3042,10 +3042,10 @@ export function canHydrateTextInstance(
30423042 return ((instance: any): TextInstance);
30433043}
30443044
3045- function canHydrateHydrationBoundary<T: SuspenseInstance | ActivityInstance> (
3045+ function canHydrateHydrationBoundary(
30463046 instance: HydratableInstance,
30473047 inRootOrSingleton: boolean,
3048- ): null | T {
3048+ ): null | SuspenseInstance | ActivityInstance {
30493049 while (instance.nodeType !== COMMENT_NODE) {
30503050 if (!inRootOrSingleton) {
30513051 return null;
@@ -3056,24 +3056,42 @@ function canHydrateHydrationBoundary<T: SuspenseInstance | ActivityInstance>(
30563056 }
30573057 instance = nextInstance;
30583058 }
3059- // This has now been refined to a suspense node.
3060- return (( instance: any): T );
3059+ // This has now been refined to a hydration boundary node.
3060+ return (instance: any);
30613061}
30623062
30633063export function canHydrateActivityInstance(
30643064 instance: HydratableInstance,
30653065 inRootOrSingleton: boolean,
30663066): null | ActivityInstance {
3067- // $FlowFixMe: This should be inferred. I can't pass explicit since it breaks build tooling.
3068- return canHydrateHydrationBoundary(instance, inRootOrSingleton);
3067+ const hydratableInstance = canHydrateHydrationBoundary(
3068+ instance,
3069+ inRootOrSingleton,
3070+ );
3071+ if (
3072+ hydratableInstance !== null &&
3073+ hydratableInstance.data === ACTIVITY_START_DATA
3074+ ) {
3075+ return (hydratableInstance: any);
3076+ }
3077+ return null;
30693078}
30703079
30713080export function canHydrateSuspenseInstance(
30723081 instance: HydratableInstance,
30733082 inRootOrSingleton: boolean,
30743083): null | SuspenseInstance {
3075- // $FlowFixMe: This should be inferred. I can't pass explicit since it breaks build tooling.
3076- return canHydrateHydrationBoundary(instance, inRootOrSingleton);
3084+ const hydratableInstance = canHydrateHydrationBoundary(
3085+ instance,
3086+ inRootOrSingleton,
3087+ );
3088+ if (
3089+ hydratableInstance !== null &&
3090+ hydratableInstance.data !== ACTIVITY_START_DATA
3091+ ) {
3092+ return (hydratableInstance: any);
3093+ }
3094+ return null;
30773095}
30783096
30793097export function isSuspenseInstancePending(instance: SuspenseInstance): boolean {
@@ -3299,6 +3317,12 @@ export function describeHydratableInstanceForDevWarnings(
32993317 props: getPropsFromElement((instance: any)),
33003318 };
33013319 } else if (instance.nodeType === COMMENT_NODE) {
3320+ if (instance.data === ACTIVITY_START_DATA) {
3321+ return {
3322+ type: 'Activity',
3323+ props: {},
3324+ };
3325+ }
33023326 return {
33033327 type: 'Suspense',
33043328 props: {},
0 commit comments