38
canHydrateSuspenseInstance,
39
getNextHydratableSibling,
40
getFirstHydratableChild,
41
+ getFirstHydratableChildWithinContainer,
42
+ getFirstHydratableChildWithinSuspenseInstance,
43
hydrateInstance,
44
hydrateTextInstance,
45
hydrateSuspenseInstance,
47
shouldDeleteUnhydratedTailInstances,
48
didNotMatchHydratedContainerTextInstance,
49
didNotMatchHydratedTextInstance,
48
- didNotHydrateContainerInstance,
50
+ didNotHydrateInstanceWithinContainer,
51
+ didNotHydrateInstanceWithinSuspenseInstance,
52
didNotHydrateInstance,
50
- didNotFindHydratableContainerInstance,
51
- didNotFindHydratableContainerTextInstance,
52
- didNotFindHydratableContainerSuspenseInstance,
53
+ didNotFindHydratableInstanceWithinContainer,
54
+ didNotFindHydratableTextInstanceWithinContainer,
55
+ didNotFindHydratableSuspenseInstanceWithinContainer,
56
+ didNotFindHydratableInstanceWithinSuspenseInstance,
57
+ didNotFindHydratableTextInstanceWithinSuspenseInstance,
58
+ didNotFindHydratableSuspenseInstanceWithinSuspenseInstance,
59
didNotFindHydratableInstance,
60
didNotFindHydratableTextInstance,
61
didNotFindHydratableSuspenseInstance,
84
return false;
85
}
86
81
- const parentInstance = fiber.stateNode.containerInfo;
82
- nextHydratableInstance = getFirstHydratableChild(parentInstance);
87
+ const parentInstance: Container = fiber.stateNode.containerInfo;
88
+ nextHydratableInstance = getFirstHydratableChildWithinContainer(
89
+ parentInstance,
90
+ );
91
hydrationParentFiber = fiber;
92
isHydrating = true;
93
return true;
100
if (!supportsHydration) {
101
return false;
102
}
95
- nextHydratableInstance = getNextHydratableSibling(suspenseInstance);
96
- popToNextHostParent(fiber);
103
+ nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(
104
+ suspenseInstance,
105
+ );
106
+ hydrationParentFiber = fiber;
107
isHydrating = true;
108
return true;
109
}
115
if (__DEV__) {
116
switch (returnFiber.tag) {
117
case HostRoot:
108
- didNotHydrateContainerInstance(
118
+ didNotHydrateInstanceWithinContainer(
119
returnFiber.stateNode.containerInfo,
120
instance,
121
);
128
instance,
129
);
130
break;
131
+ case SuspenseComponent:
132
+ const suspenseState: SuspenseState = returnFiber.memoizedState;
133
+ if (suspenseState.dehydrated !== null)
134
+ didNotHydrateInstanceWithinSuspenseInstance(
135
+ suspenseState.dehydrated,
136
+ instance,
137
+ );
138
+ break;
139
}
140
}
141
162
case HostComponent:
163
const type = fiber.type;
164
const props = fiber.pendingProps;
147
- didNotFindHydratableContainerInstance(parentContainer, type, props);
165
+ didNotFindHydratableInstanceWithinContainer(
166
+ parentContainer,
167
+ type,
168
+ props,
169
+ );
170
break;
171
case HostText:
172
const text = fiber.pendingProps;
151
- didNotFindHydratableContainerTextInstance(parentContainer, text);
173
+ didNotFindHydratableTextInstanceWithinContainer(
174
+ parentContainer,
175
+ text,
176
+ );
177
break;
178
case SuspenseComponent:
154
- didNotFindHydratableContainerSuspenseInstance(parentContainer);
179
+ didNotFindHydratableSuspenseInstanceWithinContainer(
180
+ parentContainer,
181
+ );
182
break;
183
}
184
break;
218
}
219
break;
220
}
221
+ case SuspenseComponent: {
222
+ const suspenseState: SuspenseState = returnFiber.memoizedState;
223
+ const parentInstance = suspenseState.dehydrated;
224
+ if (parentInstance !== null)
225
+ switch (fiber.tag) {
226
+ case HostComponent:
227
+ const type = fiber.type;
228
+ const props = fiber.pendingProps;
229
+ didNotFindHydratableInstanceWithinSuspenseInstance(
230
+ parentInstance,
231
+ type,
232
+ props,
233
+ );
234
+ break;
235
+ case HostText:
236
+ const text = fiber.pendingProps;
237
+ didNotFindHydratableTextInstanceWithinSuspenseInstance(
238
+ parentInstance,
239
+ text,
240
+ );
241
+ break;
242
+ case SuspenseComponent:
243
+ didNotFindHydratableSuspenseInstanceWithinSuspenseInstance(
244
+ parentInstance,
245
+ );
246
+ break;
247
+ }
248
+ break;
249
+ }
250
default:
251
return;
252
}