Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c990df

Browse files
sarikesunlei
authored andcommitted
fix: ignore unsupported action instead of throw
(cherry picked from commit 1108a0a89a13c7b3b4ab751f4b283bacfa168f8b)
1 parent 03657d6 commit 0c990df

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

client/packages/openblocks-core/lib/index.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3338,7 +3338,8 @@ var MultiBaseComp = /** @class */ (function (_super) {
33383338
MultiBaseComp.prototype.reduce = function (action) {
33393339
var comp = this.reduceOrUndefined(action);
33403340
if (!comp) {
3341-
throw new Error("not supported action, should not happen");
3341+
console.warn("not supported action, should not happen, action:", action, "\ncurrent comp:", this);
3342+
return this;
33423343
}
33433344
return comp;
33443345
};

client/packages/openblocks-core/lib/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3330,7 +3330,8 @@ var MultiBaseComp = /** @class */ (function (_super) {
33303330
MultiBaseComp.prototype.reduce = function (action) {
33313331
var comp = this.reduceOrUndefined(action);
33323332
if (!comp) {
3333-
throw new Error("not supported action, should not happen");
3333+
console.warn("not supported action, should not happen, action:", action, "\ncurrent comp:", this);
3334+
return this;
33343335
}
33353336
return comp;
33363337
};

client/packages/openblocks-core/src/baseComps/multiBaseComp.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ export abstract class MultiBaseComp<
6363
override reduce(action: CompAction): this {
6464
const comp = this.reduceOrUndefined(action);
6565
if (!comp) {
66-
throw new Error("not supported action, should not happen");
66+
console.warn(
67+
"not supported action, should not happen, action:",
68+
action,
69+
"\ncurrent comp:",
70+
this
71+
);
72+
return this;
6773
}
6874
return comp;
6975
}

0 commit comments

Comments
 (0)