SupremeTechnopriest / react-idle-timer

User activity timer component
https://idletimer.dev
MIT License
1.15k stars 143 forks source link

onMessage being trigged with old function reference cross-tab #327

Closed tomfa closed 1 year ago

tomfa commented 1 year ago

Bug information

The reference used to execute onMessage is the first reference of that function. I can only reproduce this with crossTab=true, and the bug only occurs in non-leader tabs.

A minimal reproducable example can be found here.

Note: you must open at least two tabs for the issue to be apparent, and it will not be present in leader tab

Affected Module

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

See codebox example here.

Expected behavior

Second tab should log updated counter value (3)

Screenshots

https://user-images.githubusercontent.com/1502702/216826601-fb1bb297-6457-410a-be98-7f104726bbbe.mov

System Information (please complete the following information)

Additional context

This might be the culprit of the issues #289 and #293

SupremeTechnopriest commented 1 year ago

Published as 5.3.3