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(select): After directly modifying the v-model value and updating the options list, the view displayed incorrectly. #3213

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

People-Sea
Copy link

Types of changes

  • New feature
  • Bug fix
  • Enhancement
  • Component style change
  • Typescript definition change
  • Documentation change
  • Coding style change
  • Refactoring
  • Test cases
  • Continuous integration
  • Breaking change
  • Others

Background and context

EN:
I need to implement selection followed by pagination using a select component, which includes a "Select All" function (accomplished by directly adding values to the v-model). However, this approach of setting values encounters issues when the :options are updated afterwards, leading to inconsistencies in the displayed selection.

CN:
我需要使用选择(Select)组件实现选中项目后进行分页的功能,并且这个组件需要包含全选的功能(通过直接给v-model增加值的方式来实现全选)。但是,采用这种方式设置值后,一旦选项(:options)数据发生更新,就会出现显示不一致的问题,即已选择的项目状态与实际不符。
Bug reproduction

Solution

EN:
Avoided redundant calls to updateSelectedOption when modelValue changes, ensuring efficient updates only when necessary.

CN:
在modelValue发生改变时,优化措施有效避免了updateSelectedOption方法的重复调用,仅在确实需要更新时才会触发,从而确保了更新过程的高效性。

How is the change tested?

Changelog

Component Changelog(CN) Changelog(EN) Related issues
Select 修复了 直接修改 v-model 后再改变 options 组件显示异常 Resolved display anomalies in the component when v-model is modified directly before updating options. Fixes #3212

Checklist:

  • Test suite passes (npm run test)
  • Provide changelog for relevant changes (e.g. bug fixes and new features) if applicable.
  • Changes are submitted to the appropriate branch (e.g. features should be submitted to feature branch and others
    should be submitted to main branch)

Other information

…the options list, the view displayed incorrectly.

This fix that the selectOption is updated for newly added or newly set values without invoking updateSelectedOption repeatedly.

Fixes arco-design#3212
Copy link

codesandbox bot commented Jul 5, 2024

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@flsion flsion self-assigned this Jul 26, 2024
@flsion flsion added the 🐛 Bug Something isn't working label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
None yet
2 participants