Skip to content

Commit

Permalink
Actually use server state for hydration in connect if available
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Dec 22, 2021
1 parent ff4f9d1 commit ed8fdc8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,7 @@ function connect<
? props.store!
: contextValue!.store

const getServerSnapshot = didStoreComeFromContext
const getServerState = didStoreComeFromContext
? contextValue.getServerState
: store.getState

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

0 comments on commit ed8fdc8

Please sign in to comment.