Skip to content

Commit 72132d9

Browse files
committed
Don't include translations if they are all blank
1 parent 6c9a6ca commit 72132d9

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/components/flow/actions/localization/MsgLocalizationForm.tsx

+14-4
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,20 @@ export default class MsgLocalizationForm extends React.Component<
136136
Object.keys(this.state.params).forEach((key: any) => {
137137
const component = components.find((c: any) => c.name === key);
138138
if (component) {
139-
localizations.push({
140-
uuid: component.uuid,
141-
translations: { params: this.state.params[key] }
142-
});
139+
const params = this.state.params[key];
140+
141+
// if each string in params is empty string, set params to null
142+
if (params.every((p: string) => p.trim() === '')) {
143+
localizations.push({
144+
uuid: component.uuid,
145+
translations: null
146+
});
147+
} else {
148+
localizations.push({
149+
uuid: component.uuid,
150+
translations: { params }
151+
});
152+
}
143153
}
144154
});
145155
}

src/components/flow/actions/sendmsg/SendMsgForm.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,9 @@ import SelectElement, { SelectOption } from 'components/form/select/SelectElemen
1717
import TextInputElement from 'components/form/textinput/TextInputElement';
1818
import TypeList from 'components/nodeeditor/TypeList';
1919
import { fakePropType } from 'config/ConfigProvider';
20-
// import { fetchAsset } from 'external';
2120
import { TemplateTranslation } from 'flowTypes';
2221
import mutate from 'immutability-helper';
2322
import * as React from 'react';
24-
// import { Asset } from 'store/flowContext';
2523
import {
2624
FormState,
2725
mergeForm,

0 commit comments

Comments
 (0)