riducers 1.0.2 → 1.0.3
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/package.json +1 -1
- package/src/index.ts +1 -2
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -130,7 +130,6 @@ interface ReducerOpts {
|
|
|
130
130
|
stateType?: 'list' | 'map' | 'static';
|
|
131
131
|
sort?: SortFn;
|
|
132
132
|
keyName?: string;
|
|
133
|
-
initialState?: any;
|
|
134
133
|
}
|
|
135
134
|
|
|
136
135
|
const OPS = ['insert', 'replace', 'delete', 'clear', 'sort'];
|
|
@@ -140,7 +139,7 @@ function reducerBuilder(key: string, opts?: ReducerOpts) {
|
|
|
140
139
|
let isMap = opts && opts?.stateType === 'map';
|
|
141
140
|
let rx = new RegExp(`^${key}/([^\/]+)$`);
|
|
142
141
|
let m = action.type.match(rx);
|
|
143
|
-
if (!m) return state ||
|
|
142
|
+
if (!m) return state || (isList ? [] : isMap ? {} : null);
|
|
144
143
|
|
|
145
144
|
let op = m[1];
|
|
146
145
|
let payload = action.payload;
|