Skip to content

Commit 1ab7ea2

Browse files
authored
Merge pull request #65 from performant-software/feature/evq198_duplicate_transmissions
EVQ #198 - Duplicate transmissions
2 parents 38e9d6c + a221861 commit 1ab7ea2

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/common/EditContainer.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,12 @@ const useEditContainer = (WrappedComponent: ComponentType<any>) => (
202202
*/
203203
onMultiAddChildAssociations(association: string, children: any) {
204204
const items = this.state.item[association];
205-
const childrenToAdd = _.filter(children, (child) => !_.find(items, this.isChild.bind(this, child)));
206-
const childrenToRemove = _.filter(items, (item) => !_.find(children, this.isChild.bind(this, item)));
207205

208-
_.each(childrenToAdd, this.onSaveChildAssociation.bind(this, association));
206+
// Add new children or update existing children
207+
_.each(children, this.onSaveChildAssociation.bind(this, association));
208+
209+
// Remove any children that no longer exist
210+
const childrenToRemove = _.filter(items, (item) => !_.find(children, this.isChild.bind(this, item)));
209211
_.each(childrenToRemove, this.onDeleteChildAssociation.bind(this, association));
210212
}
211213

src/semantic-ui/EditModal.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ type Props = EditContainerProps & {
2323
const EditModal = (props: Props) => {
2424
const OuterComponent = props.component;
2525

26-
const [showToaster, setShowToaster] = useState(true);
26+
const [showToaster, setShowToaster] = useState(false);
2727
const hasErrors = !!(props.errors && props.errors.length);
2828

29-
// Allow the user to clear the error toaster. If the set of validation errors changes, display the toaster again.
30-
useEffect(() => setShowToaster(true), [props.errors]);
31-
3229
return (
3330
<OuterComponent
3431
{...props}
@@ -62,7 +59,10 @@ const EditModal = (props: Props) => {
6259
>
6360
<Button
6461
disabled={props.saving}
65-
onClick={props.onSave.bind(this)}
62+
onClick={() => {
63+
setShowToaster(true);
64+
return props.onSave();
65+
}}
6666
primary
6767
size='medium'
6868
type='submit'

src/semantic-ui/EditPage.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export const useEditPage = (WrappedComponent: ComponentType<any>) => (
5050

5151
this.state = {
5252
currentTab: '',
53-
showToaster: true
53+
showToaster: false
5454
};
5555
}
5656

@@ -114,7 +114,10 @@ export const useEditPage = (WrappedComponent: ComponentType<any>) => (
114114
className='button-container'
115115
>
116116
<SaveButton
117-
onClick={this.props.onSave.bind(this)}
117+
onClick={() => {
118+
this.setState({ showToaster: true });
119+
return this.props.onSave();
120+
}}
118121
saving={this.props.saving}
119122
/>
120123
<CancelButton
@@ -188,7 +191,7 @@ export const useEditPage = (WrappedComponent: ComponentType<any>) => (
188191
>
189192
<Menu.Item>
190193
<SaveButton
191-
onClick={this.props.onSave.bind(this)}
194+
onClick={this.onSave.bind(this)}
192195
saving={this.props.saving}
193196
/>
194197
<CancelButton

0 commit comments

Comments
 (0)