adding documentation comment to explain new isFromSockets property

This commit is contained in:
Dave 2021-03-16 19:47:42 +00:00
parent 8b4f09a2c4
commit dedf0be0b9
1 changed files with 8 additions and 0 deletions

View File

@ -102,6 +102,14 @@ const mutations = {
set(state, players = []) { set(state, players = []) {
state.players = players; state.players = players;
}, },
/**
The update mutation also has a property for isFromSockets
this property can be addded to payload object for any mutations
then can be used to prevent infinite loops when a property is
able to be set from multiple different session on websockets.
An example of this is in the sendPlayerPronouns and _updatePlayerPronouns
in socket.js.
*/
update(state, { player, property, value }) { update(state, { player, property, value }) {
const index = state.players.indexOf(player); const index = state.players.indexOf(player);
if (index >= 0) { if (index >= 0) {