[redux-ssr] Question about hasServerState, setServerState and cleanServerState
- Dominant language
- JavaScript
- Stars
- 2.9k
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
Description
I have trouble understanding those 3 variables that are used for SSR.
For example, I would like to understand that is the role of those variable for the container PostList.js
```
componentWillMount() {
const { readList, hasServerState, setServerState, cleanServerState } = this.props
if (!hasServerState) {
if (isServer) {
readList().then(setServerState, setServerState)
} else {
readList()
}
} else if (isBrowser) {
cleanServerState()
}
}
...
const withServerState = fetchState(
state => ({
hasServerState: !!state.data,
}),
actions => ({
setServerState: data => actions.done({ data }),
cleanServerState: () => actions.done(),
})
)
```
`hasServerState: !!state.data,` I am wondering when this conditional is true?
I do not see the `data` property anywhere on the redux state. Where does state.data come from?
Is it within the scope of the selector or is it the root state object?
`setServerState`call the done function with `{ data }` where does this data go ? I guess this is not operating at the root level of the state, is it?
`cleanServerState` just call done. What is the purpose of this function ?
Is there other use case where cleanServerState does a little more that that ?
Thanks for the good work.
Cheers
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.