Changelog
mobx-view-model
11.0.0
Major Changes
3266f80: Remove the
disableWrappingobservable configuration option. Base implementations now always apply MobX annotations unless a custom annotation function is provided.3266f80: Breaking:
mobx-view-modelis now framework-agnostic. React bindings must be imported frommobx-view-model-react; themobx-view-model/reactexport has been removed.Breaking: replace the ViewModelStore attachment lifecycle APIs with
define(),create(),connect(),unmount(), andgenerateId(). Automatic and global core view-model ID generation have been removed; store callers must provide an ID, while framework integrations own any render-time ID generation or customgenerateId()behavior.Breaking: ViewModel lifecycle and metadata APIs have changed. The
ViewModelinterface now requiresvmmetadata, with lifecycle state available asvm.stateinstead ofisUnmounting. Resource data is available asvm.data.ViewModelBase.vmConfigandViewModelBase.isPayloadEqualare no longer exposed; configure payload comparison withcomparePayload. Also replaceViewModelSimple.attachViewModelStorewithinit(), andprocessViewComponentwith framework-agnosticprocessRender.Improve view-model creation and lifecycle handling for React 18 and React 19 Strict Mode, Suspense, lazy-loaded components, and SSR.
Removed
ViewModelStore.markToBeAttached()ViewModelStore.attach()andViewModelStore.detach()ViewModelStore.isAbleToRenderView()ViewModelStore.createViewModel()ViewModelStore.processCreateConfig()ViewModelStore.generateViewModelId()ViewModelStoreBase.getOrCreateVmId()and its attachment/mounting stateViewModel.isUnmountingandViewModel.payloadChangedfrom theViewModelinterface; lifecycle state is available through the newViewModel.vm.state.ViewModelBase.vmConfigandViewModelBase.isPayloadEqual.ViewModelParams.parentViewModelIdViewModelSimple.attachViewModelStore()ViewModelStore.mountedViewsCountGenerateViewModelIdFnandgenerateVmId- the
mobx-view-model/reactexport and React dependencies from the core package - configuration options
generateId,flushPendingReactions,useReactIds,suspendUntil,wrapViewsInObserver, andprocessViewComponent - the misspelled
isViewModeSimpleClassexport
Changed
ViewModelStore.generateId()now receives a requiredidand returns it by default; custom stores can override it for application-specific IDs.ViewModelBase.setPayload()now returns whether the payload was unchanged.ViewModelBase.willMount()may be asynchronous, and concurrentmount()calls are deduplicated.ViewModelBase.unmount()is synchronous; lifecycle state is exposed throughvm.stateinstead ofisUnmounting.- View-model resource data is exposed through
vm.data. - Parent view models must be passed through
parentViewModel; the store no longer resolves them fromparentViewModelId. ViewModelsConfig.processViewComponentwas renamed toprocessRenderand now works with framework-agnostic render functions.ViewModelsConfignow requiresmodeandgetPayload;reactHookalso uses a framework-agnostic signature.- Runtime detection of full and simple view models is now explicit and no longer depends on the presence of
payloadChanged.
Added
ViewModelStore.define()to create, connect, register, and reuse a view-model instance by ID.ViewModelStore.create()for creating an instance without registering it.ViewModelStore.connect()for registering an existing instance after creation or render commit.ViewModelStore.unmount()for synchronous unmount and removal from the store.ViewModelStore.resourceandViewModelResourcefor request-scoped SSR resources.- Solid now resolves synchronous store or global resource data into
vm.datawhen creating a view model. ViewModelSimple.init()as the initialization hook for simple view models.- Required
ViewModel.vmmetadata containing lifecyclestateand resourcedata. ViewModelsConfig.processRender()as the framework-agnostic render hook.- More reliable
isViewModel(),isViewModelClass(),isViewModelSimple(), andisViewModelSimpleClass()classification for custom view-model classes. - React staging and cleanup for abandoned renders, Suspense retries, lazy components, Strict Mode, and SSR.
Patch Changes
- 3266f80: Namespace React and Solid view-model contexts to prevent cross-framework collisions.
10.2.4
Patch Changes
- 87bb630: fixed bug with infinite loops in lazy VM charged components caused by unstable 19 React
- Updated dependencies [87bb630]
- mobx-view-model-react@10.3.1
10.2.3
Patch Changes
- 3bd28fa: [internal] update pnpm to latest for internal builds
- 3bd28fa: update yummies to latest (better tree shaking)
- Updated dependencies [3bd28fa]
- Updated dependencies [3bd28fa]
- Updated dependencies [3bd28fa]
- mobx-view-model-react@10.3.0
10.2.2
Patch Changes
- 8641eb3: migration npm publish to trusted gh actions
- Updated dependencies [8641eb3]
- mobx-view-model-react@10.2.2
10.2.1
Patch Changes
4544908Thanks @js2me! - better display names for React components wrapped inwithViewModelHOCUpdated dependencies [
4544908]:- mobx-view-model-react@10.2.1
10.2.0
Minor Changes
Patch Changes
- Updated dependencies [
f9f9096]:- mobx-view-model-react@10.2.0
10.1.2
Patch Changes
Updated dependencies [
3a9658a]:- mobx-view-model-react@10.1.2
10.1.1
Patch Changes
Updated dependencies [
43181f7]:- mobx-view-model-react@10.1.1
10.1.0
Minor Changes
Patch Changes
10.0.5
Patch Changes
e79697aThanks @js2me! - [internal] updated ci/cd to improve gh workflowsUpdated dependencies [
e79697a]:- mobx-view-model-react@10.0.5
10.0.4
Patch Changes
2cae23dThanks @js2me! - fixed async promise behabiour for vm base mountUpdated dependencies []:
- mobx-view-model-react@10.0.4
10.0.3
Patch Changes
8b35ea4Thanks @js2me! - remove warning #2 about async mount (reason: there is no problem to use async mount)Updated dependencies [
58de2dd]:- mobx-view-model-react@10.0.3
10.0.2
Patch Changes
Updated dependencies [
6a326a8]:- mobx-view-model-react@10.0.2
10.0.1
Patch Changes
Updated dependencies [
378e48b]:- mobx-view-model-react@10.0.0
10.0.0
Major Changes
#59
4473e12Thanks @js2me! -useCreateViewModel:attach/mountnow run in the hook body during the same render pass (after instance creation andsetPayload), instead of only insideuseLayoutEffect.useLayoutEffectis still used for teardown (detach/unmount). This changes timing relative to effects and child rendering compared to the previous release.#59
3ea47e5Thanks @js2me! - ModifiedViewModelBase/ViewModelSimpleMobX reactions execution flowCall
flushPendingReactions()after creating a view model inuseCreateViewModelso MobX reactions scheduled during construction run beforeattach/mountin the same render pass. Previously reactions could flush later (e.g. aftermount()when used undermobx-reactobserver), which changed effective execution order.#65
ac889c1Thanks @js2me! - Remove the deprecatedViewModelBase#getParentViewModelmethod.Use the
parentViewModelgetter directly; parent resolution now lives entirely in the base implementation.
Minor Changes
#59
f0d3729Thanks @js2me! - addflushPendingReactionsoption toviewModelsConfig#59
2831cf2Thanks @js2me! - improved SSR with Next.JS (hydration)
Patch Changes
#59
2a44bcaThanks @js2me! - added ssr example with NextJS (examples/ssr-nextjs)Updated dependencies [
9ce86ce]:- mobx-view-model-react@9.3.2
9.3.1
Patch Changes
51a3fccThanks @js2me! - fixed typings for React dependent params (using React global namespace)Updated dependencies [
51a3fcc]:- mobx-view-model-react@9.3.1
9.3.0
Minor Changes
c429474Thanks @js2me! - move all React.js components hooks and etc to own packagemobx-view-model-react
Patch Changes
- Updated dependencies [
c429474]:- mobx-view-model-react@9.3.0
