Skip to content

Commit 10829e9

Browse files
committed
Fix: Use getOffscreenContainerProps
The type of these props is different per renderer. An oversight from facebook#21960. Unfortunately wasn't caught by Flow because fiber props are `any`-typed.
1 parent f87c6e1 commit 10829e9

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.new.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,12 +2216,12 @@ function mountSuspenseFallbackChildren(
22162216
supportsPersistence &&
22172217
(workInProgress.mode & ConcurrentMode) === NoMode
22182218
) {
2219-
const isHidden = true;
22202219
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
2221-
const containerProps = {
2222-
hidden: isHidden,
2220+
2221+
const containerProps = getOffscreenContainerProps(
2222+
'hidden',
22232223
primaryChildren,
2224-
};
2224+
);
22252225
offscreenContainer.pendingProps = containerProps;
22262226
offscreenContainer.memoizedProps = containerProps;
22272227
completeSuspendedOffscreenHostContainer(null, offscreenContainer);
@@ -2373,13 +2373,12 @@ function updateSuspenseFallbackChildren(
23732373
// In persistent mode, the offscreen children are wrapped in a host node.
23742374
// We need to complete it now, because we're going to skip over its normal
23752375
// complete phase and go straight to rendering the fallback.
2376-
const isHidden = true;
23772376
const currentOffscreenContainer = currentPrimaryChildFragment.child;
23782377
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
2379-
const containerProps = {
2380-
hidden: isHidden,
2378+
const containerProps = getOffscreenContainerProps(
2379+
'hidden',
23812380
primaryChildren,
2382-
};
2381+
);
23832382
offscreenContainer.pendingProps = containerProps;
23842383
offscreenContainer.memoizedProps = containerProps;
23852384
completeSuspendedOffscreenHostContainer(

packages/react-reconciler/src/ReactFiberBeginWork.old.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2216,12 +2216,12 @@ function mountSuspenseFallbackChildren(
22162216
supportsPersistence &&
22172217
(workInProgress.mode & ConcurrentMode) === NoMode
22182218
) {
2219-
const isHidden = true;
22202219
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
2221-
const containerProps = {
2222-
hidden: isHidden,
2220+
2221+
const containerProps = getOffscreenContainerProps(
2222+
'hidden',
22232223
primaryChildren,
2224-
};
2224+
);
22252225
offscreenContainer.pendingProps = containerProps;
22262226
offscreenContainer.memoizedProps = containerProps;
22272227
completeSuspendedOffscreenHostContainer(null, offscreenContainer);
@@ -2373,13 +2373,12 @@ function updateSuspenseFallbackChildren(
23732373
// In persistent mode, the offscreen children are wrapped in a host node.
23742374
// We need to complete it now, because we're going to skip over its normal
23752375
// complete phase and go straight to rendering the fallback.
2376-
const isHidden = true;
23772376
const currentOffscreenContainer = currentPrimaryChildFragment.child;
23782377
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
2379-
const containerProps = {
2380-
hidden: isHidden,
2378+
const containerProps = getOffscreenContainerProps(
2379+
'hidden',
23812380
primaryChildren,
2382-
};
2381+
);
23832382
offscreenContainer.pendingProps = containerProps;
23842383
offscreenContainer.memoizedProps = containerProps;
23852384
completeSuspendedOffscreenHostContainer(

0 commit comments

Comments
 (0)