Skip to content

Commit 9ffdec3

Browse files
committed
CC #311 - Updating DataList onSave function to wrap onSave prop in a Promise.resolve
1 parent 777a70d commit 9ffdec3

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/semantic-ui/DataList.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,7 @@ const useDataList = (WrappedComponent: ComponentType<any>) => (
305305
* @returns {Q.Promise<any> | Promise<R> | Promise<any> | void | *}
306306
*/
307307
onSave(item: any) {
308-
return this.props
309-
.onSave(item)
308+
return Promise.resolve(this.props.onSave(item))
310309
.then(() => this.setState({ saved: true }, this.fetchData.bind(this)));
311310
}
312311

stories/components/semantic-ui/ListTable.stories.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,7 @@ export const AddButton = useDragDrop(() => (
629629
perPage: number('Per page', 10)
630630
}))}
631631
onDelete={action('delete')}
632-
onSave={() => {
633-
action('save')();
634-
return Promise.resolve();
635-
}}
632+
onSave={action('save')}
636633
searchable={boolean('Searchable', true)}
637634
/>
638635
));

0 commit comments

Comments
 (0)