close
Skip to content

Design pillar: shutdown() must be reversible — listeners & state survive #3

@productdevbook

Description

@productdevbook

Competitor wrappers all suffer the same lifecycle bug: calling `shutdown()` and then `boot()` again leaves the widget in a broken state. We need a deterministic state machine.

Evidence

Contract — state machine

`idle → loading → ready → shutdown → idle`

  1. Listener registry lives at adapter level, not in the client's React/Vue closure. Survives shutdown; re-binds on next boot.
  2. `shutdown()` actually removes: script tag, window globals, CSS injected, iframe, registered listeners.
  3. `reconfigure(newOpts)` = `shutdown() + load(newOpts)` atomically; no intermediate `idle` observable.
  4. `boot()` is idempotent & singleton-by-config-hash. Called twice with same opts ⇒ returns existing handle. Called with different opts ⇒ clean teardown first.
  5. `destroy()` is the hard kill (removes all state); `shutdown()` keeps the user session data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    competitor-analysisDerived from OSS competitor issue patternsdesign-pillarCore design decisionslifecycleboot/shutdown/re-init/strict mode

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions