Skip to content

Design multi-tab-safe collection reset coordination for web #269

Description

@kilbot

Summary

Track the follow-up work to make RxDB collection reset operations safe and predictable across multiple open POS tabs/windows.

Why

As part of the RxDB 17 / storage migration work, web will move to OPFS for performance. That migration is intentionally scoped to storage/platform changes only.

However, collection lifecycle operations like clear and refresh still need their own design for multi-tab behavior:

  • one tab may remove and recreate a collection
  • other tabs may still hold stale JS RxCollection references
  • local-only observables like collections$ are not enough by themselves for cross-tab coordination

Goal

Design and implement a robust cross-tab coordination model for collection reset flows so that when one tab clears/recreates a collection, other tabs either:

  • safely rebind to the new collection instance, or
  • gracefully soft-reload / recover without data corruption or broken queries

Suggested investigation topics

  • current use of collection.onRemove() and other lifecycle hooks
  • whether to coordinate via BroadcastChannel, RxState, or another shared channel
  • how non-originating tabs discover reset completion and reacquire fresh collection instances
  • timeout / failure / retry behavior
  • UX when recovery is not immediate
  • whether closeDuplicates is compatible with supported multi-tab POS usage

Acceptance criteria

  • documented expected behavior for clear-and-refresh with 2+ open tabs
  • explicit coordination protocol for reset lifecycle events
  • recovery path for non-originating tabs
  • tests or manual verification steps covering multi-tab scenarios

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions