Skip to content

Handshake issue with multiple children #68

@hymccord

Description

@hymccord

Repro using the vanilla-js:

  1. Open parent P.
  2. Open a child tab C1
  3. Open another child tab C2
  4. Reload C1
  5. Go back to parent tab and send a message to C2 (notice that message goes to C1)
  6. Reload C2. See that it C1 original data shows (even though this window name is Child 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions