Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/components/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -641,13 +641,17 @@ function connect<
}, [didStoreComeFromProps, contextValue, subscription])

// Set up refs to coordinate values between the subscription effect and the render logic
const lastChildProps = React.useRef<unknown>()
const lastChildProps = React.useRef<unknown>(undefined)
const lastWrapperProps = React.useRef(wrapperProps)
const childPropsFromStoreUpdate = React.useRef<unknown>()
const childPropsFromStoreUpdate = React.useRef<unknown>(undefined)
const renderIsScheduled = React.useRef(false)
const isMounted = React.useRef(false)

const latestSubscriptionCallbackError = React.useRef<Error>()
// TODO: Change this to `React.useRef<Error>(undefined)` after upgrading to React 19.
/**
* @todo Change this to `React.useRef<Error>(undefined)` after upgrading to React 19.
*/
const latestSubscriptionCallbackError = React.useRef<Error | undefined>(undefined)

useIsomorphicLayoutEffect(() => {
isMounted.current = true
Expand Down Expand Up @@ -752,11 +756,11 @@ function connect<
const renderedWrappedComponent = React.useMemo(() => {
return (
// @ts-ignore
<WrappedComponent
(<WrappedComponent
{...actualChildProps}
ref={reactReduxForwardedRef}
/>
)
/>)
);
}, [reactReduxForwardedRef, WrappedComponent, actualChildProps])

// If React sees the exact same element reference as last time, it bails out of re-rendering
Expand Down