Skip to content

Commit

Permalink
fix(v3): notify before local room state update
Browse files Browse the repository at this point in the history
  • Loading branch information
jkrumm committed Jan 28, 2024
1 parent 41a69dd commit 03c3ecc
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/store/room-state.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ export const useRoomStateStore = create<RoomStateStore>((set, get) => ({
setConnectedAt: () => set({ connectedAt: Date.now() }),
// Interactions
update: (roomState: RoomStateClient) => {
const oldRoomState = {
users: get().users,
isAutoFlip: get().isAutoFlip,
isFlipped: get().isFlipped,
};
const user = roomState.getUser(get().userId);
set({
// User
Expand All @@ -66,12 +71,8 @@ export const useRoomStateStore = create<RoomStateStore>((set, get) => ({
isAutoFlip: roomState.isAutoFlip,
isFlipped: roomState.isFlipped,
},
oldRoomState: {
users: get().users,
isAutoFlip: get().isAutoFlip,
isFlipped: get().isFlipped,
},
userId: get().userId,
oldRoomState,
userId: user.id,
connectedAt: get().connectedAt,
});
},
Expand Down

1 comment on commit 03c3ecc

@vercel
Copy link

@vercel vercel bot commented on 03c3ecc Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.