jotai-state-tree 1.7.4 → 1.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-WEWWBVTQ.mjs → chunk-I2ZPT6O4.mjs} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/react.d.mts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +2 -2
- package/dist/react.mjs +1 -1
- package/dist/{router-DzUdXVV7.d.mts → router-DwXAzNVB.d.mts} +1 -1
- package/dist/{router-DzUdXVV7.d.ts → router-DwXAzNVB.d.ts} +1 -1
- package/package.json +2 -2
- package/src/__tests__/router.test.tsx +4 -0
- package/src/router.ts +2 -2
|
@@ -3797,7 +3797,7 @@ var RouterModel = model("RouterModel", {
|
|
|
3797
3797
|
if (res === false) {
|
|
3798
3798
|
revert();
|
|
3799
3799
|
} else if (typeof res === "string") {
|
|
3800
|
-
self.
|
|
3800
|
+
self.replace(res);
|
|
3801
3801
|
} else {
|
|
3802
3802
|
proceed();
|
|
3803
3803
|
}
|
|
@@ -3808,7 +3808,7 @@ var RouterModel = model("RouterModel", {
|
|
|
3808
3808
|
if (result === false) {
|
|
3809
3809
|
revert();
|
|
3810
3810
|
} else if (typeof result === "string") {
|
|
3811
|
-
self.
|
|
3811
|
+
self.replace(result);
|
|
3812
3812
|
} else {
|
|
3813
3813
|
proceed();
|
|
3814
3814
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
export {
|
|
1
|
+
import { I as IType, a as ISimpleType, b as ILiteralType, c as IEnumerationType, d as IFrozenType, e as IIdentifierType, f as IIdentifierNumberType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance } from './router-DwXAzNVB.mjs';
|
|
2
|
+
export { C as CustomTypeOptions, x as IActionRecorder, y as IActionRecording, z as IAnyComplexType, A as IAnyMixin, B as IHistoryEntry, D as IJsonPatch, E as IMSTArray, F as IMSTMap, G as IReversibleJsonPatch, H as IStateTreeNode, J as ITimeTravelManager, K as IUndoManager, L as IUndoManagerOptions, N as IValidationContext, O as IValidationError, P as IValidationResult, Q as ModelInstance, T as ModelSelf, V as RouteDefinition, W as RouterModel, X as SnapshotOut, Y as applyPatch, Z as applySnapshot, _ as cleanupStaleEntries, $ as clearAllRegistries, a0 as clone, a1 as cloneDeep, a2 as createActionRecorder, a3 as createRouter, a4 as createTimeTravelManager, a5 as createUndoManager, a6 as destroy, a7 as detach, a8 as findAll, a9 as findFirst, aa as freeze, ab as getEnv, ac as getGlobalStore, ad as getIdentifier, ae as getMembers, af as getOrCreatePath, ag as getParent, ah as getParentOfType, ai as getPath, aj as getPathParts, ak as getRegistryStats, al as getRelativePath, am as getRoot, an as getSnapshot, ao as getTreeStats, ap as getType, aq as hasParent, ar as haveSameRoot, as as isAlive, at as isAncestor, au as isFrozen, av as isRoot, aw as isStateTreeNode, ax as isValidReference, ay as onAction, az as onLifecycleChange, aA as onPatch, aB as onSnapshot, aC as recordPatches, aD as resetGlobalStore, aE as resolveIdentifier, aF as resolvePath, aG as setGlobalStore, aH as tryGetParent, aI as tryResolve, aJ as unfreeze, aK as walk } from './router-DwXAzNVB.mjs';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { I as
|
|
2
|
-
export {
|
|
1
|
+
import { I as IType, a as ISimpleType, b as ILiteralType, c as IEnumerationType, d as IFrozenType, e as IIdentifierType, f as IIdentifierNumberType, M as ModelProperties, g as IModelType, h as MixinConfig, i as IMixin, j as IAnyType, k as IArrayType, l as IMapType, m as IOptionalType, n as IMaybeType, o as IMaybeNullType, p as IUnionType, U as UnionOptions, q as ILateType, r as IAnyModelType, R as ReferenceOptions, s as IReferenceType, t as ISafeReferenceType, u as IRefinementType, v as IDisposer, S as SnapshotIn, w as Instance } from './router-DwXAzNVB.js';
|
|
2
|
+
export { C as CustomTypeOptions, x as IActionRecorder, y as IActionRecording, z as IAnyComplexType, A as IAnyMixin, B as IHistoryEntry, D as IJsonPatch, E as IMSTArray, F as IMSTMap, G as IReversibleJsonPatch, H as IStateTreeNode, J as ITimeTravelManager, K as IUndoManager, L as IUndoManagerOptions, N as IValidationContext, O as IValidationError, P as IValidationResult, Q as ModelInstance, T as ModelSelf, V as RouteDefinition, W as RouterModel, X as SnapshotOut, Y as applyPatch, Z as applySnapshot, _ as cleanupStaleEntries, $ as clearAllRegistries, a0 as clone, a1 as cloneDeep, a2 as createActionRecorder, a3 as createRouter, a4 as createTimeTravelManager, a5 as createUndoManager, a6 as destroy, a7 as detach, a8 as findAll, a9 as findFirst, aa as freeze, ab as getEnv, ac as getGlobalStore, ad as getIdentifier, ae as getMembers, af as getOrCreatePath, ag as getParent, ah as getParentOfType, ai as getPath, aj as getPathParts, ak as getRegistryStats, al as getRelativePath, am as getRoot, an as getSnapshot, ao as getTreeStats, ap as getType, aq as hasParent, ar as haveSameRoot, as as isAlive, at as isAncestor, au as isFrozen, av as isRoot, aw as isStateTreeNode, ax as isValidReference, ay as onAction, az as onLifecycleChange, aA as onPatch, aB as onSnapshot, aC as recordPatches, aD as resetGlobalStore, aE as resolveIdentifier, aF as resolvePath, aG as setGlobalStore, aH as tryGetParent, aI as tryResolve, aJ as unfreeze, aK as walk } from './router-DwXAzNVB.js';
|
|
3
3
|
import 'jotai/vanilla/internals';
|
|
4
4
|
import 'jotai';
|
|
5
5
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -4619,7 +4619,7 @@ var RouterModel = model("RouterModel", {
|
|
|
4619
4619
|
if (res === false) {
|
|
4620
4620
|
revert();
|
|
4621
4621
|
} else if (typeof res === "string") {
|
|
4622
|
-
self.
|
|
4622
|
+
self.replace(res);
|
|
4623
4623
|
} else {
|
|
4624
4624
|
proceed();
|
|
4625
4625
|
}
|
|
@@ -4630,7 +4630,7 @@ var RouterModel = model("RouterModel", {
|
|
|
4630
4630
|
if (result === false) {
|
|
4631
4631
|
revert();
|
|
4632
4632
|
} else if (typeof result === "string") {
|
|
4633
|
-
self.
|
|
4633
|
+
self.replace(result);
|
|
4634
4634
|
} else {
|
|
4635
4635
|
proceed();
|
|
4636
4636
|
}
|
package/dist/index.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import React, { FC, ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ac as getGlobalStore, J as ITimeTravelManager, L as IUndoManagerOptions, K as IUndoManager } from './router-DwXAzNVB.mjs';
|
|
3
|
+
export { aL as RouterContext, aM as hasStateTreeNode, aN as useRouter } from './router-DwXAzNVB.mjs';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import React, { FC, ReactNode, ComponentType } from 'react';
|
|
2
|
+
import { ac as getGlobalStore, J as ITimeTravelManager, L as IUndoManagerOptions, K as IUndoManager } from './router-DwXAzNVB.js';
|
|
3
|
+
export { aL as RouterContext, aM as hasStateTreeNode, aN as useRouter } from './router-DwXAzNVB.js';
|
|
4
4
|
import 'jotai/vanilla/internals';
|
|
5
5
|
import 'jotai';
|
|
6
6
|
|
package/dist/react.js
CHANGED
|
@@ -2748,7 +2748,7 @@ var RouterModel = model("RouterModel", {
|
|
|
2748
2748
|
if (res === false) {
|
|
2749
2749
|
revert();
|
|
2750
2750
|
} else if (typeof res === "string") {
|
|
2751
|
-
self.
|
|
2751
|
+
self.replace(res);
|
|
2752
2752
|
} else {
|
|
2753
2753
|
proceed();
|
|
2754
2754
|
}
|
|
@@ -2759,7 +2759,7 @@ var RouterModel = model("RouterModel", {
|
|
|
2759
2759
|
if (result === false) {
|
|
2760
2760
|
revert();
|
|
2761
2761
|
} else if (typeof result === "string") {
|
|
2762
|
-
self.
|
|
2762
|
+
self.replace(result);
|
|
2763
2763
|
} else {
|
|
2764
2764
|
proceed();
|
|
2765
2765
|
}
|
package/dist/react.mjs
CHANGED
|
@@ -725,4 +725,4 @@ declare function createRouter(config: {
|
|
|
725
725
|
declare const RouterContext: React.Context<any>;
|
|
726
726
|
declare function useRouter(): any;
|
|
727
727
|
|
|
728
|
-
export {
|
|
728
|
+
export { clearAllRegistries as $, type IAnyMixin as A, type IHistoryEntry as B, type CustomTypeOptions as C, type IJsonPatch as D, type IMSTArray as E, type IMSTMap as F, type IReversibleJsonPatch as G, type IStateTreeNode as H, type IType as I, type ITimeTravelManager as J, type IUndoManager as K, type IUndoManagerOptions as L, type ModelProperties as M, type IValidationContext as N, type IValidationError as O, type IValidationResult as P, type ModelInstance as Q, type ReferenceOptions as R, type SnapshotIn as S, type ModelSelf as T, type UnionOptions as U, RouteDefinition as V, RouterModel as W, type SnapshotOut as X, applyPatch as Y, applySnapshot as Z, cleanupStaleEntries as _, type ISimpleType as a, clone as a0, cloneDeep as a1, createActionRecorder as a2, createRouter as a3, createTimeTravelManager as a4, createUndoManager as a5, destroy as a6, detach as a7, findAll as a8, findFirst as a9, onPatch as aA, onSnapshot as aB, recordPatches as aC, resetGlobalStore as aD, resolveIdentifier as aE, resolvePath as aF, setGlobalStore as aG, tryGetParent as aH, tryResolve as aI, unfreeze as aJ, walk as aK, RouterContext as aL, hasStateTreeNode as aM, useRouter as aN, freeze as aa, getEnv as ab, getGlobalStore as ac, getIdentifier as ad, getMembers as ae, getOrCreatePath as af, getParent as ag, getParentOfType as ah, getPath as ai, getPathParts as aj, getRegistryStats as ak, getRelativePath as al, getRoot as am, getSnapshot as an, getTreeStats as ao, getType as ap, hasParent as aq, haveSameRoot as ar, isAlive as as, isAncestor as at, isFrozen as au, isRoot as av, isStateTreeNode as aw, isValidReference as ax, onAction as ay, onLifecycleChange as az, type ILiteralType as b, type IEnumerationType as c, type IFrozenType as d, type IIdentifierType as e, type IIdentifierNumberType as f, type IModelType as g, type MixinConfig as h, type IMixin as i, type IAnyType as j, type IArrayType as k, type IMapType as l, type IOptionalType as m, type IMaybeType as n, type IMaybeNullType as o, type IUnionType as p, type ILateType as q, type IAnyModelType as r, type IReferenceType as s, type ISafeReferenceType as t, type IRefinementType as u, type IDisposer as v, type Instance as w, type IActionRecorder as x, type IActionRecording as y, type IAnyComplexType as z };
|
|
@@ -725,4 +725,4 @@ declare function createRouter(config: {
|
|
|
725
725
|
declare const RouterContext: React.Context<any>;
|
|
726
726
|
declare function useRouter(): any;
|
|
727
727
|
|
|
728
|
-
export {
|
|
728
|
+
export { clearAllRegistries as $, type IAnyMixin as A, type IHistoryEntry as B, type CustomTypeOptions as C, type IJsonPatch as D, type IMSTArray as E, type IMSTMap as F, type IReversibleJsonPatch as G, type IStateTreeNode as H, type IType as I, type ITimeTravelManager as J, type IUndoManager as K, type IUndoManagerOptions as L, type ModelProperties as M, type IValidationContext as N, type IValidationError as O, type IValidationResult as P, type ModelInstance as Q, type ReferenceOptions as R, type SnapshotIn as S, type ModelSelf as T, type UnionOptions as U, RouteDefinition as V, RouterModel as W, type SnapshotOut as X, applyPatch as Y, applySnapshot as Z, cleanupStaleEntries as _, type ISimpleType as a, clone as a0, cloneDeep as a1, createActionRecorder as a2, createRouter as a3, createTimeTravelManager as a4, createUndoManager as a5, destroy as a6, detach as a7, findAll as a8, findFirst as a9, onPatch as aA, onSnapshot as aB, recordPatches as aC, resetGlobalStore as aD, resolveIdentifier as aE, resolvePath as aF, setGlobalStore as aG, tryGetParent as aH, tryResolve as aI, unfreeze as aJ, walk as aK, RouterContext as aL, hasStateTreeNode as aM, useRouter as aN, freeze as aa, getEnv as ab, getGlobalStore as ac, getIdentifier as ad, getMembers as ae, getOrCreatePath as af, getParent as ag, getParentOfType as ah, getPath as ai, getPathParts as aj, getRegistryStats as ak, getRelativePath as al, getRoot as am, getSnapshot as an, getTreeStats as ao, getType as ap, hasParent as aq, haveSameRoot as ar, isAlive as as, isAncestor as at, isFrozen as au, isRoot as av, isStateTreeNode as aw, isValidReference as ax, onAction as ay, onLifecycleChange as az, type ILiteralType as b, type IEnumerationType as c, type IFrozenType as d, type IIdentifierType as e, type IIdentifierNumberType as f, type IModelType as g, type MixinConfig as h, type IMixin as i, type IAnyType as j, type IArrayType as k, type IMapType as l, type IOptionalType as m, type IMaybeType as n, type IMaybeNullType as o, type IUnionType as p, type ILateType as q, type IAnyModelType as r, type IReferenceType as s, type ISafeReferenceType as t, type IRefinementType as u, type IDisposer as v, type Instance as w, type IActionRecorder as x, type IActionRecording as y, type IAnyComplexType as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jotai-state-tree",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5",
|
|
4
4
|
"description": "MobX-State-Tree API compatible library powered by Jotai",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"semantic-release": "^25.0.2",
|
|
78
78
|
"tsup": "^8.0.0",
|
|
79
79
|
"typedoc": "^0.28.15",
|
|
80
|
-
"typescript": "^
|
|
80
|
+
"typescript": "^6.0.3",
|
|
81
81
|
"vitest": "^4.0.16"
|
|
82
82
|
},
|
|
83
83
|
"repository": {
|
|
@@ -421,6 +421,8 @@ describe('State Router', () => {
|
|
|
421
421
|
popStateCallback(new PopStateEvent('popstate', { state: null }));
|
|
422
422
|
});
|
|
423
423
|
expect(router.pathname).toBe('/users/redirected');
|
|
424
|
+
expect(window.history.replaceState).toHaveBeenCalledWith(undefined, '', '/users/redirected');
|
|
425
|
+
expect(window.history.pushState).not.toHaveBeenCalled();
|
|
424
426
|
|
|
425
427
|
// 2. PopState promise rejection (should revert URL)
|
|
426
428
|
vi.stubGlobal('location', { pathname: '/files/error', search: '', hash: '' });
|
|
@@ -533,6 +535,8 @@ describe('State Router', () => {
|
|
|
533
535
|
popStateCallback(new PopStateEvent('popstate', { state: null }));
|
|
534
536
|
});
|
|
535
537
|
expect(r4.pathname).toBe('/users/redirected');
|
|
538
|
+
expect(window.history.replaceState).toHaveBeenCalledWith(undefined, '', '/users/redirected');
|
|
539
|
+
expect(window.history.pushState).not.toHaveBeenCalled();
|
|
536
540
|
|
|
537
541
|
// 5. popstate with async beforeNavigate resolving to false
|
|
538
542
|
const r5 = createRouter({
|
package/src/router.ts
CHANGED
|
@@ -349,7 +349,7 @@ export const RouterModel = model("RouterModel", {
|
|
|
349
349
|
if (res === false) {
|
|
350
350
|
revert();
|
|
351
351
|
} else if (typeof res === "string") {
|
|
352
|
-
self.
|
|
352
|
+
self.replace(res);
|
|
353
353
|
} else {
|
|
354
354
|
proceed();
|
|
355
355
|
}
|
|
@@ -360,7 +360,7 @@ export const RouterModel = model("RouterModel", {
|
|
|
360
360
|
if (result === false) {
|
|
361
361
|
revert();
|
|
362
362
|
} else if (typeof result === "string") {
|
|
363
|
-
self.
|
|
363
|
+
self.replace(result);
|
|
364
364
|
} else {
|
|
365
365
|
proceed();
|
|
366
366
|
}
|