Skip to content

Commit

Permalink
Merge pull request #1204 from Wizleap-Inc/feat/1203_search_selector
Browse files Browse the repository at this point in the history
Bug: optionsに存在しないmodelValue/valuesを突っ込むと動かなくなる/UIがバグる箇所の修正
  • Loading branch information
ichi-h authored Feb 5, 2024
2 parents f16756a + 30ce402 commit bf91945
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .changeset/breezy-deers-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@wizleap-inc/wiz-ui-react": patch
"@wizleap-inc/wiz-ui-next": patch
---

fix(search-selector): options に存在しない modelValue/values を突っ込むと動かなくなる/UI がバグる箇所の修正
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
</button>
</span>
<input
v-if="multiSelectable || !isValueMatched"
v-if="
multiSelectable || !isValueMatched || selectedItem.length === 0
"
:class="selectBoxSearchInputStyle"
:value="searchValue"
@input="onSetSearchValue"
Expand Down Expand Up @@ -255,7 +257,11 @@ const valueToOption = computed(() =>
);
const selectedItem = computed(() => {
return props.modelValue.map((v) => valueToOption.value[v]);
// props.options.values の値の配列
const values = props.options.map((v) => v.value);
return props.modelValue
.filter((v) => values.includes(v))
.map((v) => valueToOption.value[v]);
});
const setUnselectableRef =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,9 @@ const SearchSelector: FC<Props> = ({
</button>
</span>
))}
{(multiSelectable || values.length === 0) && (
{(multiSelectable ||
values.length === 0 ||
selectedOptions.length === 0) && (
<input
ref={searchTextboxRef}
className={styles.selectBoxSearchInputStyle}
Expand Down

0 comments on commit bf91945

Please sign in to comment.