@oxog/state 1.3.1 → 1.4.0
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-R6MFYVYQ.js → chunk-2QNZBQ4V.js} +12 -5
- package/dist/chunk-2QNZBQ4V.js.map +1 -0
- package/dist/{chunk-IWT3T2PM.cjs → chunk-V6ASKKTH.cjs} +12 -5
- package/dist/chunk-V6ASKKTH.cjs.map +1 -0
- package/dist/iife/index.global.js +1 -1
- package/dist/index.cjs +70 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/vanilla.cjs +66 -66
- package/dist/vanilla.d.cts +2 -2
- package/dist/vanilla.d.ts +2 -2
- package/dist/vanilla.js +1 -1
- package/package.json +18 -9
- package/dist/chunk-IWT3T2PM.cjs.map +0 -1
- package/dist/chunk-R6MFYVYQ.js.map +0 -1
|
@@ -282,13 +282,14 @@ var Kernel = class {
|
|
|
282
282
|
} catch (error) {
|
|
283
283
|
throw new StoreError(
|
|
284
284
|
"PLUGIN_INSTALL_FAILED" /* PLUGIN_INSTALL_FAILED */,
|
|
285
|
+
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions -- message format kept from 1.x (the error's string form)
|
|
285
286
|
`Failed to install plugin '${plugin.name}': ${error}`,
|
|
286
287
|
{ cause: error }
|
|
287
288
|
);
|
|
288
289
|
}
|
|
289
290
|
this.plugins.set(plugin.name, instance);
|
|
290
291
|
if (!this.initializing && plugin.onInit) {
|
|
291
|
-
this.runOnInit(plugin, store);
|
|
292
|
+
void this.runOnInit(plugin, store);
|
|
292
293
|
}
|
|
293
294
|
}
|
|
294
295
|
/**
|
|
@@ -563,6 +564,12 @@ var StoreImpl = class {
|
|
|
563
564
|
if (update === null || update === void 0) {
|
|
564
565
|
return;
|
|
565
566
|
}
|
|
567
|
+
if (typeof update !== "object" || Array.isArray(update)) {
|
|
568
|
+
throw new StoreError(
|
|
569
|
+
"INVALID_STATE_UPDATE" /* INVALID_STATE_UPDATE */,
|
|
570
|
+
`setState expects an object or a function returning one, got ${Array.isArray(update) ? "an array" : typeof update}`
|
|
571
|
+
);
|
|
572
|
+
}
|
|
566
573
|
this.state = { ...this.state, ...withoutProtoKey(update) };
|
|
567
574
|
this.notifyOrQueue(this.state, prevState);
|
|
568
575
|
}
|
|
@@ -1484,7 +1491,7 @@ function createFederation(stores, options = {}) {
|
|
|
1484
1491
|
},
|
|
1485
1492
|
transaction(fn) {
|
|
1486
1493
|
if (isInTransaction) {
|
|
1487
|
-
fn(stores);
|
|
1494
|
+
void fn(stores);
|
|
1488
1495
|
return;
|
|
1489
1496
|
}
|
|
1490
1497
|
isInTransaction = true;
|
|
@@ -1943,7 +1950,7 @@ function history(options = {}) {
|
|
|
1943
1950
|
internalState = null;
|
|
1944
1951
|
const previousPresent = historyState.present;
|
|
1945
1952
|
const newPresent = state;
|
|
1946
|
-
let hasChanged
|
|
1953
|
+
let hasChanged;
|
|
1947
1954
|
if (keys && keys.length > 0) {
|
|
1948
1955
|
hasChanged = keys.some((key) => {
|
|
1949
1956
|
return previousPresent[key] !== newPresent[key];
|
|
@@ -3218,5 +3225,5 @@ exports.toMiddlewareApi = toMiddlewareApi;
|
|
|
3218
3225
|
exports.triggerSync = triggerSync;
|
|
3219
3226
|
exports.validate = validate;
|
|
3220
3227
|
exports.waitForFederated = waitForFederated;
|
|
3221
|
-
//# sourceMappingURL=chunk-
|
|
3222
|
-
//# sourceMappingURL=chunk-
|
|
3228
|
+
//# sourceMappingURL=chunk-V6ASKKTH.cjs.map
|
|
3229
|
+
//# sourceMappingURL=chunk-V6ASKKTH.cjs.map
|