CodeVetter · Repo Unpack · Behavior traces
mobxjs/mobx
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.
- Explicit model initialization follows makeObservable → initObservable → asObservableObject → make_ → annotation.make_; observable annotation dispatch reaches defineObservableProperty_, which installs descriptors and constructs ObservableValue.
- Initial autorun follows autorun → new Reaction → schedule_ → runReactions → runReaction_ → track(reactionRunner) → trackDerivedFunction → view; an already-aborted signal prevents the initial schedule.
- 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.
- 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.
- 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.
- 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.
- 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.