Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeistrich committed Jan 1, 2025
1 parent e61f0c9 commit b75c59d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/ObservableObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,25 +475,31 @@ const proxyHandler: ProxyHandler<any> = {
};
}

// If this is an observable property that has been added by config functions, return it
const property = observableProperties.get(p);
if (property) {
return property.get(node);
}

// Get raw value of the property
let vProp = value?.[p];

// If it's an opaque object, can skip the rest of the logic
if (isObject(value) && isHintOpaque(value)) {
return vProp;
}

const fnOrComputed = node.functions?.get(p);
if (fnOrComputed) {
if (isObservable(fnOrComputed)) {
// If it's a linked observable, return the target
return fnOrComputed;
} else {
// Otherwise return a proxy to the function
return getProxy(node, p, fnOrComputed as Function);
}
} else {
// Check if this is a property that has been added by defineProperty
vProp = checkProperty(value, p);
}

Expand Down

0 comments on commit b75c59d

Please sign in to comment.