maxgram/react-saga-universal

Components don't re-render on state change (specifically when receiving new props from saga)

Closed this issue · 2 comments

This is an awesome boilerplate but I just can't seem to get it to re-render when there is a props change. In my case I'm expecting the page to automatically update when a saga receives new data and its updated in the state -- the state is updating properly but its not visible, and I figure this is because it only renders the page on initial load. Do I need to implement something to trigger a flush of the chunks that are updated? If you could point me in the right direction I'd greatly appreciate it!

Take a look at counter example in this commit

If it doesn't help please show some code (reducer) :)

Wow that was fast, thanks! That did it. I realized I needed to include the update action in the page's connect function:

(before):
export default connect( state => ({ isFetching: state.game.isFetching, id: state.game.id, status: state.game.status, away_id: state.game.away_id, home_id: state.game.home_id, away_uid: state.game.away_uid, home_uid: state.game.home_uid, away_abbr: state.game.away_abbr, home_abbr: state.game.home_abbr, title: state.game.title, details: state.game.details }), { loadGame } )(Game)

(after):
export default connect( state => ({ isFetching: state.game.isFetching, id: state.game.id, status: state.game.status, away_id: state.game.away_id, home_id: state.game.home_id, away_uid: state.game.away_uid, home_uid: state.game.home_uid, away_abbr: state.game.away_abbr, home_abbr: state.game.home_abbr, title: state.game.title, details: state.game.details }), { loadGame, updateGame } )(Game)