Skip to content

Commit

Permalink
fix(core): ensure observe prop is defined before calling defineProper…
Browse files Browse the repository at this point in the history
…ty (#3666)

fix #3631
  • Loading branch information
aitboudad committed May 1, 2023
1 parent 1dd5c6e commit d8cafc8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/src/lib/utils.ts
Expand Up @@ -276,7 +276,7 @@ export function observe<T = any>(o: IObserveTarget<T>, paths: string[], setFn: I
if (state.onChange.indexOf(setFn) === -1) {
state.onChange.push(setFn);
setFn({ currentValue: state.value, firstChange: true });
if (state.onChange.length >= 1) {
if (state.onChange.length >= 1 && isObject(target)) {
const { enumerable } = Object.getOwnPropertyDescriptor(target, key) || { enumerable: true };
Object.defineProperty(target, key, {
enumerable,
Expand Down

0 comments on commit d8cafc8

Please sign in to comment.