You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeofaction!=='string'||!action.length||action.charAt(0)==='_' ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Cannot use action `%s`. Each action must be a sting with at least one character and cannot start with an underscore.',action) : (0,_invariant["default"])(false) : undefined;
20
-
Object.prototype.hasOwnProperty.call(_this,action) ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Action `%s` is already set (duplicate actions are not allowed).',action) : (0,_invariant["default"])(false) : undefined;
12
+
typeofaction!=='string'||!action.length||action.charAt(0)==='_' ? process.env.NODE_ENV!=='production' ? invariant(false,'Cannot use action `%s`. Each action must be a sting with at least one character and cannot start with an underscore.',action) : invariant(false) : undefined;
13
+
Object.prototype.hasOwnProperty.call(_this,action) ? process.env.NODE_ENV!=='production' ? invariant(false,'Action `%s` is already set (duplicate actions are not allowed).',action) : invariant(false) : undefined;
function_isNativeReflectConstruct(){try{vart=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function_isNativeReflectConstruct(){return!!t;})();}/* global process */
this._vlowState_!==_states["default"].init ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Component `%s` is trying to register a store outside the constructor.',this.constructor.name) : (0,_invariant["default"])(false) : undefined;
28
+
this._vlowState_!==States.init ? process.env.NODE_ENV!=='production' ? invariant(false,'Component `%s` is trying to register a store outside the constructor.',this.constructor.name) : invariant(false) : undefined;
35
29
// Debug only valid props
36
30
if(process.env.NODE_ENV!=='production'){
37
-
(0,_invariant["default"])(store.constructor!==Array,'Component `%s` is registering a store using an Array, most likely you are using `.mapStore()` instead of `.mapStores()`.',this.constructor.name);
31
+
invariant(store.constructor!==Array,'Component `%s` is registering a store using an Array, most likely you are using `.mapStore()` instead of `.mapStores()`.',this.constructor.name);
(0,_invariant["default"])(!invalidProps.length,'Component `%s` is registering a store using invalid properties: `%s` (only `store`, `keys` and `altState` are allowed).',this.constructor.name,invalidProps);
36
+
invariant(!invalidProps.length,'Component `%s` is registering a store using invalid properties: `%s` (only `store`, `keys` and `altState` are allowed).',this.constructor.name,invalidProps);
43
37
}
44
38
}// End debug
45
39
varkeys=store.keys;
46
40
varaltState=store.altState;
47
-
keys&&altState ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Component `%s` is registering a store using both `keys` and `altState` but they cannot be used at the same time.',this.constructor.name) : (0,_invariant["default"])(false) : undefined;
48
-
store=_store["default"]._vlowGetOrCreateStore(typeofstore==='function' ? store : store.store);
41
+
keys&&altState ? process.env.NODE_ENV!=='production' ? invariant(false,'Component `%s` is registering a store using both `keys` and `altState` but they cannot be used at the same time.',this.constructor.name) : invariant(false) : undefined;
42
+
store=Store._vlowGetOrCreateStore(typeofstore==='function' ? store : store.store);
49
43
if(!this._vlowStores_.includes(store)){
50
44
store._vlowAddListener(this,keys,altState);
51
45
this._vlowStores_.push(store);
@@ -55,31 +49,31 @@ var ComponentFactory = function ComponentFactory(SuperClass) {
55
49
},{
56
50
key: "mapStore",
57
51
value: functionmapStore(store){
58
-
this._vlowTmpState!==null ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Component `%s` must only make one call to either `.mapStore()` or `.mapStores()`.',this.constructor.name) : (0,_invariant["default"])(false) : undefined;
52
+
this._vlowTmpState!==null ? process.env.NODE_ENV!=='production' ? invariant(false,'Component `%s` must only make one call to either `.mapStore()` or `.mapStores()`.',this.constructor.name) : invariant(false) : undefined;
59
53
this._vlowRegisterStore_(store);
60
54
}
61
55
},{
62
56
key: "mapStores",
63
57
value: functionmapStores(stores){
64
58
var_this2=this;
65
-
this._vlowTmpState!==null ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Component `%s` must only make one call to either `.mapStore()` or `.mapStores()`.',this.constructor.name) : (0,_invariant["default"])(false) : undefined;
66
-
stores.constructor!==Array ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Function `.mapStores()` on Component `%s` is expecting an Array got got `%s`.',this.constructor.name,stores) : (0,_invariant["default"])(false) : undefined;
59
+
this._vlowTmpState!==null ? process.env.NODE_ENV!=='production' ? invariant(false,'Component `%s` must only make one call to either `.mapStore()` or `.mapStores()`.',this.constructor.name) : invariant(false) : undefined;
60
+
stores.constructor!==Array ? process.env.NODE_ENV!=='production' ? invariant(false,'Function `.mapStores()` on Component `%s` is expecting an Array got got `%s`.',this.constructor.name,stores) : invariant(false) : undefined;
67
61
stores.forEach(function(s){
68
62
return_this2._vlowRegisterStore_(s);
69
63
});
70
64
}
71
65
},{
72
66
key: "componentDidMount",
73
67
value: functioncomponentDidMount(){
74
-
this._vlowState_=_states["default"].ready;
75
-
!!this._vlowTmpState&&this._vlowTmpState!==this.state ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Component `%s` state has been overwritten after registering a store.',this.constructor.name) : (0,_invariant["default"])(false) : undefined;
68
+
this._vlowState_=States.ready;
69
+
!!this._vlowTmpState&&this._vlowTmpState!==this.state ? process.env.NODE_ENV!=='production' ? invariant(false,'Component `%s` state has been overwritten after registering a store.',this.constructor.name) : invariant(false) : undefined;
76
70
deletethis._vlowTmpState;
77
71
}
78
72
},{
79
73
key: "componentWillUnmount",
80
74
value: functioncomponentWillUnmount(){
81
75
var_this3=this;
82
-
this._vlowState_=_states["default"].stop;
76
+
this._vlowState_=States.stop;
83
77
this._vlowStores_.forEach(function(store){
84
78
returnstore._vlowRemoveListener(_this3);
85
79
});
@@ -90,15 +84,15 @@ var ComponentFactory = function ComponentFactory(SuperClass) {
@@ -94,14 +86,14 @@ var Store = /*#__PURE__*/function () {
94
86
state=!listener.keys ? !listener.altState ? state : listener.altState(this.state,component.state,component.props)||{} : this._vlowFilterState(state,listener.keys);
95
87
if(Object.keys(state).length){
96
88
switch(component._vlowState_){
97
-
case_states["default"].init:
98
-
counter ? process.env.NODE_ENV!=='production' ? (0,_invariant["default"])(false,'Store `%s` is using `setState()` with a callback on component `%s` which is not yet mounted. This is not possible, make sure all components are mounted or remove the callback from setState.',this.constructor.name,component.constructor.name) : (0,_invariant["default"])(false) : undefined;
counter ? process.env.NODE_ENV!=='production' ? invariant(false,'Store `%s` is using `setState()` with a callback on component `%s` which is not yet mounted. This is not possible, make sure all components are mounted or remove the callback from setState.',this.constructor.name,component.constructor.name) : invariant(false) : undefined;
0 commit comments