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): can not set initial value for non-datasource approach #1743

Merged
merged 3 commits into from
Jul 20, 2021

Conversation

anranruye
Copy link
Member

@anranruye anranruye commented Jul 17, 2021

🤔 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

Fixes #1735

💡 Background and solution

A sample:
image

This issue is introduced by #1720 . In #1720, I changed the position to call OnValueChange method. In most cases, this change is safe. However, OnValueChange should do nothing for the first call(by evaluating the _isInitialized field), but the method is now first called after _isInitialized is set to true. We can solve this issue by simply move _isInitialized = true; to after the call to OnValueChange. Let me know if you think we should use a new variable or variable name in this case.

📝 Changelog

Language Changelog
🇺🇸 English fix the issue that can not set select component initial value for non-datasource approach
🇨🇳 Chinese 修复当使用SelectOption方案时不能为Select组件设置初始值的问题

☑️ 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 Jul 17, 2021

@codecov
Copy link

codecov bot commented Jul 17, 2021

Codecov Report

Merging #1743 (1386c98) into master (bdcc42c) will increase coverage by 0.01%.
The diff coverage is 69.23%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1743      +/-   ##
==========================================
+ Coverage   17.91%   17.92%   +0.01%     
==========================================
  Files         448      448              
  Lines       29261    29271      +10     
==========================================
+ Hits         5241     5248       +7     
- Misses      24020    24023       +3     
Impacted Files Coverage Δ
components/select/Select.razor.cs 19.07% <69.23%> (+0.35%) ⬆️

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 bdcc42c...1386c98. Read the comment docs.

@ElderJames ElderJames force-pushed the master branch 3 times, most recently from 367e011 to bdcc42c Compare July 19, 2021 04:56
@ElderJames ElderJames merged commit 015129c into ant-design-blazor:master Jul 20, 2021
@anranruye anranruye deleted the FixSelectInitValue branch July 20, 2021 07:09
ElderJames added a commit that referenced this pull request Apr 23, 2022
…roach (#1743)

* fix(module: select): can not set initial value for non-datasource approach

* Update Select.razor.cs

Co-authored-by: James Yeung <shunjiey@hotmail.com>
ElderJames added a commit that referenced this pull request Apr 30, 2022
…roach (#1743)

* fix(module: select): can not set initial value for non-datasource approach

* Update Select.razor.cs

Co-authored-by: James Yeung <shunjiey@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting value of a boolean and nullable boolean in select displays wrong value
2 participants