# Behavior traces — mobxjs/mobx

> Canonical page: https://codevetter.com/unpack/mobx/behavior-traces

# Behavior traces — mobxjs/mobx

Scanned commit 60be47cab0926d12f22449ec6c809fb5ec6601c4 (2026-09-30). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

The source supports complete walks through import initialization, observable construction, mutation propagation, and React rendering. Additional traces follow conversion, application-level autosave, and codemod execution. The autosave trace is explicitly a documentation example; it does not establish a bundled persistence service.
- Import startup initializes or merges MobXGlobals during module evaluation, checks Symbol/Map/Set/Proxy availability in development, exports the public API, and conditionally calls injectMobx on the development tools hook. — [packages/mobx/src/core/globalstate.ts#L161-L189](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/globalstate.ts#L161-L189) [packages/mobx/src/mobx.ts#L18-L30](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/mobx.ts#L18-L30) [packages/mobx/src/mobx.ts#L157-L168](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/mobx.ts#L157-L168)
- Explicit model initialization follows makeObservable → initObservable → asObservableObject → make_ → annotation.make_; observable annotation dispatch reaches defineObservableProperty_, which installs descriptors and constructs ObservableValue. — [packages/mobx/src/api/makeObservable.ts#L22-L33](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/api/makeObservable.ts#L22-L33) [packages/mobx/src/api/makeObservable.ts#L85-L114](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/api/makeObservable.ts#L85-L114) [packages/mobx/src/types/observableannotation.ts#L22-L44](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/types/observableannotation.ts#L22-L44) [packages/mobx/src/types/observableobject.ts#L389-L418](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/types/observableobject.ts#L389-L418)
- Initial autorun follows autorun → new Reaction → schedule_ → runReactions → runReaction_ → track(reactionRunner) → trackDerivedFunction → view; an already-aborted signal prevents the initial schedule. — [packages/mobx/src/api/autorun.ts#L56-L96](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/api/autorun.ts#L56-L96) [packages/mobx/src/core/reaction.ts#L116-L150](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/reaction.ts#L116-L150) [packages/mobx/src/core/reaction.ts#L154-L188](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/reaction.ts#L154-L188) [packages/mobx/src/core/derivation.ts#L166-L198](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/derivation.ts#L166-L198)
- A boxed action update follows createAction → executeAction → _startAction → ObservableValue.set → setNewValue_ → Atom.reportChanged → propagateChanged → Reaction.schedule_; _endAction → endBatch releases queued reactions after the enclosing batch finishes. — [packages/mobx/src/core/action.ts#L49-L75](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/action.ts#L49-L75) [packages/mobx/src/core/action.ts#L109-L153](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/action.ts#L109-L153) [packages/mobx/src/types/observablevalue.ts#L94-L137](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/types/observablevalue.ts#L94-L137) [packages/mobx/src/core/atom.ts#L94-L98](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/core/atom.ts#L94-L98)
- Function rendering follows observer → optional forwardRef unwrapping → memo wrapper → useObserver → createObserverAdministration/createReaction → useSyncExternalStore → reaction.track(render); invalidation changes the snapshot, while unsubscription disposes the reaction. — [packages/mobx-react-lite/src/observer.ts#L58-L95](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/observer.ts#L58-L95) [packages/mobx-react-lite/src/useObserver.ts#L23-L73](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/useObserver.ts#L23-L73) [packages/mobx-react-lite/src/useObserver.ts#L81-L125](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/useObserver.ts#L81-L125)
- Abandoned-render cleanup follows registry.register → microtask flushRegistrations → native and timer registration → finalizeRegistration → observerFinalizationRegistry callback → Reaction.dispose; a later subscribe recreates a missing reaction and changes its snapshot to restore tracking. — [packages/mobx-react-lite/src/utils/UniversalFinalizationRegistry.ts#L69-L95](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/utils/UniversalFinalizationRegistry.ts#L69-L95) [packages/mobx-react-lite/src/utils/UniversalFinalizationRegistry.ts#L115-L124](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/utils/UniversalFinalizationRegistry.ts#L115-L124) [packages/mobx-react-lite/src/utils/observerFinalizationRegistry.ts#L4-L9](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/utils/observerFinalizationRegistry.ts#L4-L9) [packages/mobx-react-lite/src/useObserver.ts#L48-L66](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-react-lite/src/useObserver.ts#L48-L66)
- The documented autosave path is Todo constructor → makeAutoObservable → reaction(() => asJson) → action-wrapped effect → transportLayer.saveTodo when autoSave is true; Todo.dispose calls the stored reaction disposer. — [docs/defining-data-stores.md#L146-L165](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/docs/defining-data-stores.md#L146-L165) [docs/defining-data-stores.md#L174-L194](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/docs/defining-data-stores.md#L174-L194) [packages/mobx/src/api/autorun.ts#L131-L177](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx/src/api/autorun.ts#L131-L177)
- Migration execution follows interpret_cli_args → spawnBin/getCommandPath → jscodeshift with undecorate.ts → transform/parser → member collection/createConstructor → import insertion → source.toSource; unchanged files can return no transformed source. — [packages/mobx-undecorate/cli.js#L11-L49](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-undecorate/cli.js#L11-L49) [packages/mobx-undecorate/cli.js#L64-L117](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-undecorate/cli.js#L64-L117) [packages/mobx-undecorate/src/undecorate.ts#L81-L115](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-undecorate/src/undecorate.ts#L81-L115) [packages/mobx-undecorate/src/undecorate.ts#L242-L278](https://github.com/mobxjs/mobx/blob/60be47cab0926d12f22449ec6c809fb5ec6601c4/packages/mobx-undecorate/src/undecorate.ts#L242-L278)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
