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

[release-2.19] fix: formkit select component not emitting event or updating selection on value change #6610

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Sep 6, 2024

This is an automated cherry-pick of #6602

/assign LIlGG

解决 Formkit Select 组件在值变更时不会发出事件及修改选项值的问题。

…n on value change (halo-dev#6602)

#### What type of PR is this?

/kind bug
/area ui
/milestone 2.20.x

#### What this PR does / why we need it:

重新修改 formkit select 初始化值的监听方式,用于当 value 发生变化时,使选项值可以发生变化。

另外在更新数据时,如果数据发生变化,则发出 `onChange` 事件。

> 需要注意的是,通过 v-modal 传入默认值,再将此值改为 `undefined` 时无法触发 `watch` 及 formkit 的 `input` 事件,原因暂时未知,将此值设置为 `""` 即可正常触发。

#### How to test it?

由于此 PR 改动了初始化的方式,因此需要全量测试所有使用 `Select` 组件的位置。包括多选与单选,本地源与远程源。确保功能符合预期。

#### Which issue(s) this PR fixes:

Fixes halo-dev#6594 

#### Does this PR introduce a user-facing change?
```release-note
解决 Formkit Select 组件在值变更时不会发出事件及修改选项值的问题。
```
@f2c-ci-robot f2c-ci-robot bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Sep 6, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from wan92hen and wzrove September 6, 2024 10:05
@LIlGG LIlGG added this to the 2.19.2 milestone Sep 6, 2024
Copy link

sonarqubecloud bot commented Sep 6, 2024

@LIlGG LIlGG changed the title [release-2.19] fix: formkit selector not listening to data after defaulting to first option [release-2.19] fix: formkit select component not emitting event or updating selection on value change Sep 6, 2024
Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Sep 6, 2024
Copy link

f2c-ci-robot bot commented Sep 6, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 6, 2024
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (release-2.19@f538f2f). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff               @@
##             release-2.19    #6610   +/-   ##
===============================================
  Coverage                ?   58.06%           
  Complexity              ?     3916           
===============================================
  Files                   ?      670           
  Lines                   ?    22966           
  Branches                ?     1575           
===============================================
  Hits                    ?    13335           
  Misses                  ?     9015           
  Partials                ?      616           

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

@f2c-ci-robot f2c-ci-robot bot merged commit dfa10c0 into halo-dev:release-2.19 Sep 6, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants