haya-select 1.0.60 → 1.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haya-select",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -114,6 +114,14 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
114
114
  this.setOptionsPositionAboveIfOutsideScreen()
115
115
  }
116
116
  }, [this.tt.callOptionsPositionAboveIfOutsideScreen, this.s.optionsContainerLayout])
117
+
118
+ useEffect(() => {
119
+ const currentOptionIds = this.s.currentOptions?.map((currentOption) => currentOption.value)
120
+
121
+ if (this.props.values && anythingDifferent(currentOptionIds, this.props.values)) {
122
+ this.setCurrentFromGivenValues()
123
+ }
124
+ }, [this.props.values])
117
125
  }
118
126
 
119
127
  defaultCurrentOptions() {
@@ -166,7 +174,7 @@ export default memo(shapeComponent(class HayaSelect extends ShapeComponent {
166
174
  return foundOption
167
175
  })
168
176
  } else if (typeof this.props.options == "function" && this.props.values) {
169
- this.setCurrentFromGivenValues()
177
+ // Options haven't been loaded yet.
170
178
  } else if (this.props.values) {
171
179
  return this.p.values.map((value) => ({value}))
172
180
  }
@@ -26,7 +26,7 @@ export default memo(shapeComponent(class Option extends ShapeComponent {
26
26
  render() {
27
27
  const {currentOptionValues, option} = this.p
28
28
  const disabled = Boolean(option.disabled)
29
- const selected = Boolean(currentOptionValues.find((currentOptionValue) => currentOptionValue == option.value))
29
+ const selected = Boolean(currentOptionValues?.find((currentOptionValue) => currentOptionValue == option.value))
30
30
  const style = {
31
31
  paddingTop: 4,
32
32
  paddingRight: 8,