Skip to content

Commit

Permalink
Fix: Use getOffscreenContainerProps
Browse files Browse the repository at this point in the history
The type of these props is different per renderer. An oversight
from #21960. Unfortunately wasn't caught by Flow because fiber props
are `any`-typed.
  • Loading branch information
acdlite committed Jul 30, 2021
1 parent f87c6e1 commit 10829e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
15 changes: 7 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.new.js
Original file line number Diff line number Diff line change
Expand Up @@ -2216,12 +2216,12 @@ function mountSuspenseFallbackChildren(
supportsPersistence &&
(workInProgress.mode & ConcurrentMode) === NoMode
) {
const isHidden = true;
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
const containerProps = {
hidden: isHidden,

const containerProps = getOffscreenContainerProps(
'hidden',
primaryChildren,
};
);
offscreenContainer.pendingProps = containerProps;
offscreenContainer.memoizedProps = containerProps;
completeSuspendedOffscreenHostContainer(null, offscreenContainer);
Expand Down Expand Up @@ -2373,13 +2373,12 @@ function updateSuspenseFallbackChildren(
// In persistent mode, the offscreen children are wrapped in a host node.
// We need to complete it now, because we're going to skip over its normal
// complete phase and go straight to rendering the fallback.
const isHidden = true;
const currentOffscreenContainer = currentPrimaryChildFragment.child;
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
const containerProps = {
hidden: isHidden,
const containerProps = getOffscreenContainerProps(
'hidden',
primaryChildren,
};
);
offscreenContainer.pendingProps = containerProps;
offscreenContainer.memoizedProps = containerProps;
completeSuspendedOffscreenHostContainer(
Expand Down
15 changes: 7 additions & 8 deletions packages/react-reconciler/src/ReactFiberBeginWork.old.js
Original file line number Diff line number Diff line change
Expand Up @@ -2216,12 +2216,12 @@ function mountSuspenseFallbackChildren(
supportsPersistence &&
(workInProgress.mode & ConcurrentMode) === NoMode
) {
const isHidden = true;
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
const containerProps = {
hidden: isHidden,

const containerProps = getOffscreenContainerProps(
'hidden',
primaryChildren,
};
);
offscreenContainer.pendingProps = containerProps;
offscreenContainer.memoizedProps = containerProps;
completeSuspendedOffscreenHostContainer(null, offscreenContainer);
Expand Down Expand Up @@ -2373,13 +2373,12 @@ function updateSuspenseFallbackChildren(
// In persistent mode, the offscreen children are wrapped in a host node.
// We need to complete it now, because we're going to skip over its normal
// complete phase and go straight to rendering the fallback.
const isHidden = true;
const currentOffscreenContainer = currentPrimaryChildFragment.child;
const offscreenContainer: Fiber = (primaryChildFragment.child: any);
const containerProps = {
hidden: isHidden,
const containerProps = getOffscreenContainerProps(
'hidden',
primaryChildren,
};
);
offscreenContainer.pendingProps = containerProps;
offscreenContainer.memoizedProps = containerProps;
completeSuspendedOffscreenHostContainer(
Expand Down

0 comments on commit 10829e9

Please sign in to comment.