Skip to content

Commit 9767c80

Browse files
committed
wip - rollback returning values in actions (not allowed w/ immer)
1 parent ac8c231 commit 9767c80

File tree

6 files changed

+12756
-63
lines changed

6 files changed

+12756
-63
lines changed

build/cami.cdn.js

+4,256-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/cami.cdn.js.map

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/cami.module.js

+4,235-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/cami.module.js.map

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/javascripts/cami.cdn.js

+4,256-18
Large diffs are not rendered by default.

src/observables/observable-store.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,13 @@ class ObservableStore extends Observable {
265265

266266
if (!reducer) {
267267
console.warn(`No reducer found for action ${action}`);
268-
return;
268+
return _deepClone(this._state);
269269
}
270270

271271
this.__applyMiddleware(action, payload);
272272

273-
let actionResult;
274273
const [nextState, patches, inversePatches] = produceWithPatches(this._state, draft => {
275-
actionResult = reducer({
274+
reducer({
276275
state: draft,
277276
payload: payload,
278277
dispatch: this.dispatch.bind(this),
@@ -282,7 +281,6 @@ class ObservableStore extends Observable {
282281
memo: this.memo.bind(this),
283282
trigger: this.trigger.bind(this)
284283
});
285-
return actionResult === undefined ? draft : actionResult;
286284
});
287285

288286
try {
@@ -320,7 +318,7 @@ class ObservableStore extends Observable {
320318
}
321319
}
322320

323-
return actionResult !== undefined ? actionResult : _deepClone(this._state);
321+
return _deepClone(this._state);
324322
} finally {
325323
this.__dispatchStack.pop();
326324
this.__isDispatching = false;

0 commit comments

Comments
 (0)