Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Proxy model not setting defined values in parent class #2187

Merged
merged 1 commit into from
Aug 13, 2024

Conversation

mattrunyon
Copy link
Collaborator

Something I noticed when working on dh.ui databars. I don't think this currently causes any issues in DHC, but it could. If we defined a member field in the proxy model and then set the value, we could end up with the wrong values.

This is only an issue if we directly set a public member. In the current proxy model, we only set via setField type functions, so things seem to be fine. Inside of class definitions the proxy is skipped (since the proxy is just returned from the ctor).

This change makes setting a member defined in the proxy class work even if you try to do it on the proxy object.

class ProxyModel {
  myField = 4
}

test = new ProxyModel();
test.myField; // 4
test.model.myField; // undefined

test.myField = 5;
test.myField; // 4 - WRONG
test.model.myField; // 5

@mattrunyon mattrunyon self-assigned this Aug 12, 2024
Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.67%. Comparing base (a257296) to head (cb7cb26).

Additional details and impacted files
@@           Coverage Diff            @@
##             main    #2187    +/-   ##
========================================
  Coverage   46.66%   46.67%            
========================================
  Files         692      692            
  Lines       38629    38630     +1     
  Branches     9814     9630   -184     
========================================
+ Hits        18028    18029     +1     
- Misses      20548    20590    +42     
+ Partials       53       11    -42     
Flag Coverage Δ
unit 46.67% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mattrunyon mattrunyon merged commit 5f9cf7f into deephaven:main Aug 13, 2024
11 checks passed
@mattrunyon mattrunyon deleted the proxy-model-fix branch August 13, 2024 16:53
@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants