react-call v2

Upsert

Singleton-style calls. The first upsert creates the call; later upserts mutate its props on the same instance. The returned promise is identical across the singleton's lifetime.

When you want one, not many

call() is the default: each invocation adds a new entry to the Stack. But sometimes the right model is "there is exactly one of these things alive, and I keep telling it what to show right now."

Notifications, loading toasts, progress indicators — these are conceptually singletons. upsert() models that directly.

upserts fired: 0
active: no

What changes between calls

  • First call: creates a new instance, returns a promise.
  • Subsequent calls: update the existing instance's props. Same promise reference.
  • After end(): the next upsert creates a new instance again.
  • Regular call()s and upsert()s are independent — they never collide.

Useful identities

Because the promise is stable across the singleton's lifetime, you can safely await it once and have your code resume when the notification finally goes away — even if its message changes a dozen times in between.