projects
/
arvados-workbench2.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
15069: Renders property chips correctly from the search query string.
[arvados-workbench2.git]
/
src
/
store
/
dialog
/
with-dialog.ts
diff --git
a/src/store/dialog/with-dialog.ts
b/src/store/dialog/with-dialog.ts
index d53a79d6efe19f5ccde771f05d1590bd77199f0e..6eaee0d2531b680419264fb10453e257527c5a31 100644
(file)
--- a/
src/store/dialog/with-dialog.ts
+++ b/
src/store/dialog/with-dialog.ts
@@
-18,18
+18,20
@@
export type WithDialogDispatchProps = {
};
export type WithDialogProps<T> = WithDialogStateProps<T> & WithDialogDispatchProps;
};
export type WithDialogProps<T> = WithDialogStateProps<T> & WithDialogDispatchProps;
-
export const withDialog = (id: string) =>
export const withDialog = (id: string) =>
- <T, P>(component: React.ComponentType<WithDialogProps<T> & P>) =>
+ // TODO: How to make compiler happy with & P instead of & any?
+ <T, P>(component: React.ComponentType<WithDialogProps<T> & any>) =>
connect(mapStateToProps(id), mapDispatchToProps(id))(component);
connect(mapStateToProps(id), mapDispatchToProps(id))(component);
+const emptyData = {};
+
export const mapStateToProps = (id: string) => <T>(state: { dialog: DialogState }): WithDialogStateProps<T> => {
const dialog = state.dialog[id];
export const mapStateToProps = (id: string) => <T>(state: { dialog: DialogState }): WithDialogStateProps<T> => {
const dialog = state.dialog[id];
- return dialog ? dialog : { open: false, data:
{}
};
+ return dialog ? dialog : { open: false, data:
emptyData
};
};
export const mapDispatchToProps = (id: string) => (dispatch: Dispatch): WithDialogDispatchProps => ({
closeDialog: () => {
dispatch(dialogActions.CLOSE_DIALOG({ id }));
}
};
export const mapDispatchToProps = (id: string) => (dispatch: Dispatch): WithDialogDispatchProps => ({
closeDialog: () => {
dispatch(dialogActions.CLOSE_DIALOG({ id }));
}
-});
\ No newline at end of file
+});