@react-remote-state/client 1.2.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -5647,9 +5647,23 @@ function createInternalReducer(reducer, acceptPlayer) {
5647
5647
  return internalAction.game;
5648
5648
  case 0 /* Reduce */:
5649
5649
  if (!!game) {
5650
- internalAction.client.emit("update", {
5651
- game: reducer(game, internalAction.action, internalAction.playerId)
5652
- });
5650
+ let updatedGame = reducer(
5651
+ game,
5652
+ internalAction.action,
5653
+ internalAction.playerId
5654
+ );
5655
+ let playerCustoms = {};
5656
+ for (let player of updatedGame.players) {
5657
+ if (!!player.custom) {
5658
+ playerCustoms[player.id] = player.custom;
5659
+ }
5660
+ }
5661
+ let update = {
5662
+ gameId: game.id,
5663
+ gameCustom: updatedGame.custom,
5664
+ playerCustoms
5665
+ };
5666
+ internalAction.client.emit("update", update);
5653
5667
  }
5654
5668
  return game;
5655
5669
  case 2 /* Accept */: