widgets: Clean up index handling.

We only need to bump up indexes if inbound
events suggest that we have incremented our
personal index from another device.

We don't want somebody else's runaway index
to affect our index.

(For both widgets the sender_id is part of
the key, so uniqueness across all senders is
not required for the integer part.)
This commit is contained in:
Steve Howell
2021-06-13 13:14:07 +00:00
committed by Tim Abbott
parent 91b8049ecf
commit 99cdfbcbe5
2 changed files with 10 additions and 12 deletions

View File

@@ -108,7 +108,8 @@ export class PollData {
votes,
});
if (this.my_idx <= idx) {
// I may have added a poll option from another device.
if (sender_id === this.me && this.my_idx <= idx) {
this.my_idx = idx + 1;
}
},