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(module: select): NotifyFieldChanged on null Values #3277

Merged

Conversation

rhodon-jargon
Copy link
Contributor

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

When making a custom input component that required support for both a single Value as well as multiple Values, I encountered the problem that setting SelectBase's Values to null (in the case I was using only a single Value would call NotifyFieldChanged. Since the field didn't actually change, but the component was rerendered on a validation state change, this resulted in an infinite loop.
I added a case for when both value and _selectedValues are null, in which case NotifyFieldChanged is not called.

📝 Changelog

EditContext.NotifyFieldChanged is no longer called when Values is kept null.

Language Changelog
🇺🇸 English Fix incorrect call of EditContext.NotifyFieldChanged when SelectBase.Values is set (unchanged) to null
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link

github-actions bot commented May 30, 2023

@codecov
Copy link

codecov bot commented May 30, 2023

Codecov Report

Patch coverage: 61.53% and project coverage change: -1.43 ⚠️

Comparison is base (4fcfc02) 45.96% compared to head (f48f475) 44.53%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3277      +/-   ##
==========================================
- Coverage   45.96%   44.53%   -1.43%     
==========================================
  Files         557      557              
  Lines       26734    26738       +4     
  Branches      266      266              
==========================================
- Hits        12288    11909     -379     
- Misses      14406    14789     +383     
  Partials       40       40              
Impacted Files Coverage Δ
components/select/SelectBase.cs 75.73% <61.53%> (-0.47%) ⬇️

... and 23 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@ElderJames ElderJames merged commit 50783c9 into ant-design-blazor:master Jun 4, 2023
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants