Commit f7db746a authored by Ryo Yamashita's avatar Ryo Yamashita Committed by Yas Naoi
Browse files

Issue #3324903 by Ryo Yamashita, hosomitm, yas: Fix the problem that the...

Issue #3324903 by Ryo Yamashita, hosomitm, yas: Fix the problem that the selection of the multi-select form is immediately canceled in Cloud Dashboard
parent e31413fc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -189,7 +189,7 @@ const EntityFormBlock = ({ keyValueRecord, cloudContext, formData, setFormData }
      return !!keyValueRecord.readOnly
        ? <LabelBlock
          name={keyValueRecord.labelName}
          value={(value as string[]).join(', ')} />
          value={(Array.isArray(value) ? value : []).join(', ')} />
        : <MultiStringInputBlock
          label={keyValueRecord.labelName}
          value={value}
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ const MultiSelectBlock = ({
      const newValue: string[] = [];
      for (let i = 0; i < e.currentTarget.options.length; i++) {
        if (e.currentTarget.options[i].selected) {
          newValue.push(recordList[i].label);
          newValue.push(recordList[i].value);
        }
      }
      setValue(newValue);
+13 −1
Original line number Diff line number Diff line
@@ -48,7 +48,19 @@ const UrlMultiSelectBlock = ({ label, value, setValue, formData, url, cloudConte
      getJsonData<{ value: string, label: string, group?: string }[]>(replacedUrl).then((jsonData) => {
        setRecordList(jsonData);
        if (value.length !== 0) {
          setValue([]);
          const valueSet = new Set();
          for (const r of jsonData) {
            valueSet.add(r.value);
          }
          const newValue: string[] = [];
          for (const v of value) {
            if (valueSet.has(v)) {
              newValue.push(v);
            }
          }
          if (value.length !== newValue.length) {
            setValue(newValue);
          }
        }
      })
    } catch {