@tramvai/state 1.44.4 → 1.46.6
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/lib/index.d.ts +1 -0
- package/lib/index.es.js +6 -2
- package/lib/index.js +6 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -9,4 +9,5 @@ export { createReducer } from './createReducer/createReducer';
|
|
|
9
9
|
export { StoreClass } from './typings';
|
|
10
10
|
export { BaseStore } from './stores/BaseStore';
|
|
11
11
|
export * from './connect/index';
|
|
12
|
+
export { Subscription } from './connect/Subscription';
|
|
12
13
|
export { devTools };
|
package/lib/index.es.js
CHANGED
|
@@ -607,7 +607,11 @@ class Subscription {
|
|
|
607
607
|
const ConnectContext = createContext(null);
|
|
608
608
|
|
|
609
609
|
const useConsumerContext = () => {
|
|
610
|
-
|
|
610
|
+
const context = useContext(ConnectContext);
|
|
611
|
+
if (!context) {
|
|
612
|
+
throw new Error('CONSUMER_CONTEXT not found, have you added "@tramvai/module-common"?');
|
|
613
|
+
}
|
|
614
|
+
return context;
|
|
611
615
|
};
|
|
612
616
|
|
|
613
617
|
function useActions(actions) {
|
|
@@ -1330,4 +1334,4 @@ function createConnect({ connectHOC = connectAdvanced, mapStateToPropsFactories:
|
|
|
1330
1334
|
const connect = /* @__PURE__ */ createConnect();
|
|
1331
1335
|
const { Consumer } = ConnectContext;
|
|
1332
1336
|
|
|
1333
|
-
export { BaseStore, Consumer, Dispatcher, DispatcherContext, Provider, connect, convertAction, createConnect, createDispatcher, createEvent, createReducer, index as devTools, useActions, useConsumerContext, useIsomorphicLayoutEffect, useSelector, useStore, useStoreSelector };
|
|
1337
|
+
export { BaseStore, Consumer, Dispatcher, DispatcherContext, Provider, Subscription, connect, convertAction, createConnect, createDispatcher, createEvent, createReducer, index as devTools, useActions, useConsumerContext, useIsomorphicLayoutEffect, useSelector, useStore, useStoreSelector };
|
package/lib/index.js
CHANGED
|
@@ -630,7 +630,11 @@ class Subscription {
|
|
|
630
630
|
const ConnectContext = React.createContext(null);
|
|
631
631
|
|
|
632
632
|
const useConsumerContext = () => {
|
|
633
|
-
|
|
633
|
+
const context = React.useContext(ConnectContext);
|
|
634
|
+
if (!context) {
|
|
635
|
+
throw new Error('CONSUMER_CONTEXT not found, have you added "@tramvai/module-common"?');
|
|
636
|
+
}
|
|
637
|
+
return context;
|
|
634
638
|
};
|
|
635
639
|
|
|
636
640
|
function useActions(actions) {
|
|
@@ -1358,6 +1362,7 @@ exports.Consumer = Consumer;
|
|
|
1358
1362
|
exports.Dispatcher = Dispatcher;
|
|
1359
1363
|
exports.DispatcherContext = DispatcherContext;
|
|
1360
1364
|
exports.Provider = Provider;
|
|
1365
|
+
exports.Subscription = Subscription;
|
|
1361
1366
|
exports.connect = connect;
|
|
1362
1367
|
exports.convertAction = convertAction;
|
|
1363
1368
|
exports.createConnect = createConnect;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/state",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.46.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tinkoff/react-hooks": "0.0.23",
|
|
22
22
|
"@tinkoff/utils": "^2.1.2",
|
|
23
|
-
"@tramvai/types-actions-state-context": "1.
|
|
23
|
+
"@tramvai/types-actions-state-context": "1.46.6",
|
|
24
24
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
25
25
|
"invariant": "^2.2.4",
|
|
26
26
|
"react-is": ">=17",
|