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

feature: Allow the ViewModel to be Null in BindValidation #152

Merged
merged 4 commits into from
Oct 24, 2020

Conversation

worldbeater
Copy link
Collaborator

@worldbeater worldbeater commented Oct 23, 2020

What kind of change does this PR introduce?

This PR changes our nullability annotations to allow passing null view models to BindValidation. This could be potentially useful in cases when the view model is initialized after the control is activated, or when a view model is replaced with another view model after activation etc.

What is the current behavior?

Currently, we don't use the viewModel parameter in BindValidation, but check if it is null and throw ANE if it is null.

What is the new behavior?

Now, we support delayed view model initialization and just don't throw when BindValidation is called.

What might this PR break?

Nothing.

@codecov
Copy link

codecov bot commented Oct 23, 2020

Codecov Report

Merging #152 into main will increase coverage by 0.07%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
+ Coverage   62.06%   62.14%   +0.07%     
==========================================
  Files          16       16              
  Lines         912      906       -6     
==========================================
- Hits          566      563       -3     
+ Misses        346      343       -3     
Impacted Files Coverage Δ
Extensions/ViewForExtensions.cs 61.53% <0.00%> (+3.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 030f250...eb9470a. Read the comment docs.

@worldbeater worldbeater marked this pull request as ready for review October 23, 2020 22:06
@worldbeater
Copy link
Collaborator Author

Added null guards where appropriate to Android extension methods for consistency with platform-agnostic BindValidations.

@worldbeater worldbeater merged commit d0c5c8f into main Oct 24, 2020
@worldbeater worldbeater deleted the nullable-view-model branch October 24, 2020 09:11
@reactiveui reactiveui locked as resolved and limited conversation to collaborators Nov 26, 2021
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