Skip to content

Commit ed8fdc8

Browse files
committed
Actually use server state for hydration in connect if available
1 parent ff4f9d1 commit ed8fdc8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/connect.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ function connect<
602602
? props.store!
603603
: contextValue!.store
604604

605-
const getServerSnapshot = didStoreComeFromContext
605+
const getServerState = didStoreComeFromContext
606606
? contextValue.getServerState
607607
: store.getState
608608

@@ -738,8 +738,9 @@ function connect<
738738
// TODO This is incredibly hacky. We've already processed the store update and calculated new child props,
739739
// TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`.
740740
actualChildPropsSelector,
741-
// TODO Need a real getServerSnapshot here
742-
actualChildPropsSelector
741+
getServerState
742+
? () => childPropsSelector(getServerState(), wrapperProps)
743+
: actualChildPropsSelector
743744
)
744745
} catch (err) {
745746
if (latestSubscriptionCallbackError.current) {

0 commit comments

Comments
 (0)