Skip to content

Run the same WordPress instance across many browser tabs (SharedWorker? Shared FS?) #32

Open

Description

@adamziel

Browsing the same WordPress instance in multiple browser tabs could be useful. Props to @gziolo for the idea.

Technically, it would take:

Activity

  1. changed the title [-][Browser] Run the same WordPress instance across many browser tabs[/-] [+]Run the same WordPress instance across many browser tabs[/+] on Oct 22, 2022
  2. eliot-akira commented on Jul 18, 2024

    @eliot-akira
    Collaborator

    A recent article describes how Notion used SharedWorker to share an SQLite database in OPFS across multiple browser tabs.

    To execute any SQLite query, the main thread of each tab sends that query to the SharedWorker, which redirects to the active tab’s dedicated Worker. Any number of tabs can make simultaneous SQLite queries as many times as they want, and it will always be routed to the single active tab.

    How we sped up Notion in the browser with WASM SQLite

    notion shared-worker architecture for sqlite-wasm in multiple tabs


    The idea was earlier explored in detail in wa-sqlite.

    It's basically how you imagined in this comment.

    Another option would be to use SharedWorker as a traffic controller that elects one of the active tabs as a "leader" and uses it to resolve all the requests.

  3. adamziel commented on Oct 5, 2024

    @adamziel
    CollaboratorAuthor

    I've explored using SharedWorkers and learned this:

    A SharedWorker would introduce coupling between Playground deployments.

    Imagine visiting playground.wordpress.net, opening a site, and implicitly starting a SharedWorker. Then a new webapp version is deployed. Then you open new tab and go there. Now we have a few choices:

    • reuse the existing SharedWorker, even though it may be incompatible with the new webapp
    • start a new SharedWorker and run multiple conflicting Playgrounds for the same site. Potentially display a modal in other running tabs
    • start a new SharedWorker, hotswap the old SharedWorker, hotswap the old webapp for the new webapp

    The solutions are either complex or a bad user experience. I'd rather not engage with this SharedWorkers at all and just wait for Emscripten to provide a filesystem backend that we could safely read and write in multiple web workers. Then we could keep running multiple independent web workers without overwriting each other's data

  4. changed the title [-]Run the same WordPress instance across many browser tabs[/-] [+]Run the same WordPress instance across many browser tabs (SharedWorker? Shared FS?)[/+] on Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions