LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
LangGraph
  • Web
  • Channels
  • Pregel
  • Prebuilt
  • Remote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
  • Ui
  • Client
  • Auth
  • React
  • Logging
  • React Ui
  • Utils
  • Server
  • Stream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
  • Store
LangGraph Checkpoint Redis
  • Shallow
  • Store
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
  • Cli
LangGraph API
LangGraph CLI
LangGraph CUA
  • Utils
LangGraph Supervisor
LangGraph Swarm
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

LangGraph
WebChannelsPregelPrebuiltRemote
React SDK
Vue SDK
Svelte SDK
Angular SDK
LangGraph SDK
UiClientAuthReactLoggingReact UiUtilsServerStream
LangGraph Checkpoint
LangGraph Checkpoint MongoDB
LangGraph Checkpoint Postgres
Store
LangGraph Checkpoint Redis
ShallowStore
LangGraph Checkpoint SQLite
LangGraph Checkpoint Validation
Cli
LangGraph API
LangGraph CLI
LangGraph CUA
Utils
LangGraph Supervisor
LangGraph Swarm
Language
Theme
JavaScript@langchain/langgraph-sdkstreamStoreListener
Type●Since v2.0

StoreListener

Minimal observable store backing every framework binding.

The shape is intentionally tiny:

  • subscribe(listener) → unsubscribe lines up with React's useSyncExternalStore.
  • getSnapshot() returns a referentially-stable value for unchanged state so React can bail out of renders.
  • Vue/Svelte/Angular bindings wrap subscribe + getSnapshot in their own reactivity primitive (shallowRef / writable / signal) in ~10 lines.

Snapshot identity matters: a listener is only useful if getSnapshot() returns a different reference when state changes. Callers MUST pass a freshly-constructed value to setState; mutating the previous snapshot in place will break React's bail-out and cause infinite re-renders.

Copy
StoreListener: () => void
View source on GitHub