-
Notifications
You must be signed in to change notification settings - Fork 111
Description
Repro using the vanilla-js:
- Open parent
P
. - Open a child tab
C1
- Open another child tab
C2
- Reload
C1
- Go back to parent tab and send a message to C2 (notice that message goes to C1)
- Reload
C2
. See that itC1
original data shows (even though this window name isChild 2
.
You'll notice that C1 tab doesn't do onInitialize
callback, but if you head over the C2 tab, you can see that it essentially "stole" C1's handshake.
If you check C2's session storage, you'll notice that it now thinks it is c1 in the session storage. When C1 reloaded, the parent tab sent the HANDSHAKE_WITH_PARENT to C2 instead of c1.
I've debugged and identified the offending code is this: https://github.com/wingify/across-tabs/blob/27ffbccc20a35c999aa43b9f619d750098ab25b4/src/event-listeners/postmessage.js#L35C1-L72C3
I don't understand the situation behind the comment but I don't ever see a situation where the Parent tab gets reloaded (F5) and still can see all the children tab it opened. The children could re-announce themselves to build the link back but this is unrelated to this issue.
The main issue is that the P is sending C1
data to C2
where C2 saves that data to session storage which affects subsequent reloads.