Skip to content

fix: combobox reactive value re-rendering from dynamic items change.#263

Merged
SupakornNetsuwan merged 2 commits into
mainfrom
supakorn/migrate/components
Oct 31, 2025
Merged

fix: combobox reactive value re-rendering from dynamic items change.#263
SupakornNetsuwan merged 2 commits into
mainfrom
supakorn/migrate/components

Conversation

@SupakornNetsuwan
Copy link
Copy Markdown
Collaborator

Why did you create this PR

  • When combobox items prop change, the component will recalculate value every times since props.items was used as a dependency array memeber, this can cause the re-rendering problem.

What did you do

  • Create useItemsChange hook, helping detech the items drift.
  • Wrap the callback under
 useItemsChange(props.items, () => {
    setValue(filterValueAppearInItems(value))
})

so that setValue(filterValueAppearInItems(value)) will only executed after props.items really changed.

Checklist

  • Self-reviewed your code
  • Wrote coverage tests
  • Added screenshots or recordings if applicable

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 31, 2025

⚠️ No Changeset found

Latest commit: c8954fd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@SupakornNetsuwan SupakornNetsuwan self-assigned this Oct 31, 2025
@SupakornNetsuwan SupakornNetsuwan merged commit b746896 into main Oct 31, 2025
1 check passed
@SupakornNetsuwan SupakornNetsuwan deleted the supakorn/migrate/components branch October 31, 2025 08:22
@SupakornNetsuwan SupakornNetsuwan restored the supakorn/migrate/components branch October 31, 2025 08:30
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.

2 participants