From 9550f36b0d708b776927e3a404422cc5e1bf4600 Mon Sep 17 00:00:00 2001 From: Victor Chabbert Date: Sun, 22 Jan 2017 17:48:28 +0100 Subject: Temp fix saga ran on location change #2 --- frontend/src/routes.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'frontend/src') diff --git a/frontend/src/routes.js b/frontend/src/routes.js index 25e849de..a707c435 100644 --- a/frontend/src/routes.js +++ b/frontend/src/routes.js @@ -1,12 +1,15 @@ +import { spawn } from 'redux-saga/effects' import usernameChoiceSaga from './sagas/usernameChoice' import gameBrowserSaga from './sagas/gameBrowser' +// TODO: Remove spawn saga when redux-saga-router has cancelable saga on route change export const makeSagaRoutes = wsConnection => ({ *'/'() { - yield usernameChoiceSaga(wsConnection) + // FIXME: spawn is a memory whore because the saga lives forever + yield spawn(usernameChoiceSaga, wsConnection) }, *'/games'() { - yield gameBrowserSaga(wsConnection) + yield spawn(gameBrowserSaga, wsConnection) } }) -- cgit