close
Skip to content

Design pillar: queue-before-load contract (never drop pre-boot calls) #1

@productdevbook

Description

@productdevbook

Every public method (load, identify, track, show, hide, shutdown, setAttribute, …) must be safe to call before the provider's CDN script has finished booting. Calls buffered into an internal queue and drained in-order once the underlying global becomes real.

Evidence from competing libraries (dozens of bugs we preempt)

Contract

  1. load() returns a Promise<void> that resolves only when the provider's real API object is exposed.
  2. Every other method synchronously enqueues, returns Promise<void> that resolves after drain.
  3. Queue is per-provider singleton keyed by config hash.
  4. For queue-native providers (Crisp \$crisp.push, HubSpot _hsq.push) we use their queue directly — we never call methods on the replaced global.
  5. Acceptance test: call every method inside Promise.resolve().then() before awaiting load() — all must land in order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    competitor-analysisDerived from OSS competitor issue patternsdesign-pillarCore design decisionslifecycleboot/shutdown/re-init/strict modetrackingEvent tracking race / queue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions