cryptag / leapchat

Ephemeral, encrypted, in-browser chat rooms
https://www.leapchat.org/
Other
184 stars 33 forks source link

User can click set username many times, dispatching multiple set user status actions #183

Open Moe-Shoman opened 6 years ago

Moe-Shoman commented 6 years ago

@Spetastian It seems like there are instances where a user can click the "Set Username" button and it dispatches multiple user status actions for the same user. Maybe we can disable the Set Username button after the first action has been dispatched.


SELECT message_id, ttl_secs, created FROM messages WHERE room_id = 'mTrnDgfZTpVcQjx99dnAhkFRGknvWZeoe4cd5eMm38XK5' AND ttl_secs = 600;
              message_id              | ttl_secs |            created
--------------------------------------+----------+-------------------------------
 a4e3fb54-74b3-46d9-9144-bd6999623afa |      600 | 2017-10-08 06:35:10.354414-07
 5b2c76e3-6049-40d5-aea5-1b708c414926 |      600 | 2017-10-08 06:35:10.664989-07
 cb2f81ca-65df-4dc1-9492-66654b19ca80 |      600 | 2017-10-08 06:35:25.527617-07
 984cd7f3-109c-4a5a-ac08-c7172713eb1f |      600 | 2017-10-08 06:35:28.319238-07
 79d65f4e-682e-4483-8346-7091de72bfbb |      600 | 2017-10-08 06:35:28.461933-07
 8b070412-aae5-4ea0-a74b-e565f34a353f |      600 | 2017-10-08 06:35:36.485021-07
 054f93ed-4418-4e7a-8318-169b672bd4cf |      600 | 2017-10-08 06:35:39.44167-07
 749573ec-b615-4183-b863-de4f49c9dc7f |      600 | 2017-10-08 06:35:39.502555-07
 3e9f1b35-7ae4-41ff-a7fb-aea9b6dea73a |      600 | 2017-10-08 06:35:39.606653-07
 ecb46c52-3f15-444f-8e8f-264ed96602e1 |      600 | 2017-10-08 06:35:39.690726-07
 1adea4f3-0845-4497-96fe-d7e868933365 |      600 | 2017-10-08 06:35:46.336149-07```
elimisteve commented 6 years ago

Context/commentary: we can see that 4 new user statuses were sent in 1 second, at 06:35:39. (And yes, we were hacking on LeapChat at 6:35am after staying up all night... and we're still going! About to call it a.. day? morning?)

Spetastian commented 6 years ago

Is this something you have observed in the logs of the running application or something that you have reproduced locally? Or both? For me it seems as though the initial username dialog always closes directly when you click the button.

elimisteve commented 6 years ago

@Spetastian Muhammad noticed the duplicated events in Redux Dev Tools, and so we reproduced the behavior on his machine, then checked his local database, and found the duplicate messages as seen above.

Spetastian commented 6 years ago

@Moe-Shoman @elimisteve Was the action being dispatched several times CHAT_SET_USERNAME or CHAT_SET_USER_STATUS? Sorry for asking lot of questions here but im having troubles reproducing this locally. I need some more context.

Moe-Shoman commented 6 years ago

@Spetastian All good, it was CHAT_SET_USER_STATUS that was being dispatched multiple times.

Spetastian commented 6 years ago

@moeshoman @elimisteve OK, but it still seems like a potential issue since Its being dispatched multiple times in a short time span?

elimisteve commented 6 years ago

@Spetastian I think @Moe-Shoman was saying that it's "[a]ll good" (that you're asking questions) in response to "Sorry for asking lot of questions here".