Skip to content

Commit 4caea05

Browse files
leolabsNeoLegends
andcommitted
🐛 Fix user votes not being synced properly between clients
This bug was caused because we didn't re-attach our user votes listeners after the user was first logged in with Spotify. Fixes #153 Co-Authored-By: Moritz Gunz <moritz.gunz@gmail.com>
1 parent 28595d1 commit 4caea05

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/sagas/party-data.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
updateUserVotes,
1919
OpenPartyStartAction,
2020
} from '../actions/party-data';
21-
import { isPartyOwnerSelector } from '../selectors/party';
21+
import { isPartyOwnerSelector, partyIdSelector } from '../selectors/party';
2222
import { ConnectionState, Party, State } from '../state';
2323
import { store } from '../store';
2424
import { requireAuth } from '../util/auth';
@@ -171,9 +171,25 @@ function* watchRoute() {
171171
}
172172
}
173173

174+
function* watchLogin() {
175+
while (true) {
176+
yield take(Types.EXCHANGE_CODE_Finish);
177+
const state: State = yield select();
178+
const partyId = partyIdSelector(state);
179+
180+
if (!partyId) {
181+
continue;
182+
}
183+
184+
yield put(cleanupParty());
185+
yield put(openPartyStart(partyId));
186+
}
187+
}
188+
174189
export default function*() {
175190
yield all([
176191
loadParty(),
177192
watchRoute(),
193+
watchLogin(),
178194
]);
179195
}

0 commit comments

Comments
 (0)