From 72132d9e02ddb73b1c2a207bee61df243559216b Mon Sep 17 00:00:00 2001 From: Eric Newcomer Date: Wed, 6 Mar 2024 12:10:23 -0800 Subject: [PATCH] Don't include translations if they are all blank --- .../localization/MsgLocalizationForm.tsx | 18 ++++++++++++++---- .../flow/actions/sendmsg/SendMsgForm.tsx | 2 -- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/flow/actions/localization/MsgLocalizationForm.tsx b/src/components/flow/actions/localization/MsgLocalizationForm.tsx index e7e166e51..618c94eb4 100644 --- a/src/components/flow/actions/localization/MsgLocalizationForm.tsx +++ b/src/components/flow/actions/localization/MsgLocalizationForm.tsx @@ -136,10 +136,20 @@ export default class MsgLocalizationForm extends React.Component< Object.keys(this.state.params).forEach((key: any) => { const component = components.find((c: any) => c.name === key); if (component) { - localizations.push({ - uuid: component.uuid, - translations: { params: this.state.params[key] } - }); + const params = this.state.params[key]; + + // if each string in params is empty string, set params to null + if (params.every((p: string) => p.trim() === '')) { + localizations.push({ + uuid: component.uuid, + translations: null + }); + } else { + localizations.push({ + uuid: component.uuid, + translations: { params } + }); + } } }); } diff --git a/src/components/flow/actions/sendmsg/SendMsgForm.tsx b/src/components/flow/actions/sendmsg/SendMsgForm.tsx index 9c25c62ef..3cdc1a918 100644 --- a/src/components/flow/actions/sendmsg/SendMsgForm.tsx +++ b/src/components/flow/actions/sendmsg/SendMsgForm.tsx @@ -17,11 +17,9 @@ import SelectElement, { SelectOption } from 'components/form/select/SelectElemen import TextInputElement from 'components/form/textinput/TextInputElement'; import TypeList from 'components/nodeeditor/TypeList'; import { fakePropType } from 'config/ConfigProvider'; -// import { fetchAsset } from 'external'; import { TemplateTranslation } from 'flowTypes'; import mutate from 'immutability-helper'; import * as React from 'react'; -// import { Asset } from 'store/flowContext'; import { FormState, mergeForm,