From a1b60863b8b0b9251f1cc13d6844ccf9af657e2d Mon Sep 17 00:00:00 2001 From: jonassnellinckx Date: Fri, 18 Jan 2019 22:46:38 +0100 Subject: [PATCH] fix download path not saving --- src/common/store/config/reducer.ts | 7 ++----- src/main/features/NotificationManager.ts | 2 ++ .../UtilitiesModel/SettingsTab/components/InputConfig.tsx | 8 +++----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/common/store/config/reducer.ts b/src/common/store/config/reducer.ts index c1641d94..0c699083 100644 --- a/src/common/store/config/reducer.ts +++ b/src/common/store/config/reducer.ts @@ -22,15 +22,12 @@ export const configReducer: Reducer = (state = initialState, action }; case ConfigActionTypes.SET_KEY: - const newConfig = { - ...state, + return { + ..._.set(state, payload.key, payload.value), // Otherwise redux connect doesn't correctly re-trigger updatedAt: Date.now() }; - _.set(newConfig, payload.key, payload.value); - - return newConfig; case PlayerActionTypes.TOGGLE_SHUFFLE: return { ...state, diff --git a/src/main/features/NotificationManager.ts b/src/main/features/NotificationManager.ts index 45d44081..75bd942b 100755 --- a/src/main/features/NotificationManager.ts +++ b/src/main/features/NotificationManager.ts @@ -27,6 +27,8 @@ export default class NotificationManager extends Feature { if (track) { + console.log('send notificat', track); + this.sendToWebContents(EVENTS.APP.SEND_NOTIFICATION, { title: track.title, message: `${track.user && track.user.username ? track.user.username : ''}`, diff --git a/src/renderer/app/components/modals/UtilitiesModel/SettingsTab/components/InputConfig.tsx b/src/renderer/app/components/modals/UtilitiesModel/SettingsTab/components/InputConfig.tsx index 47ff79d9..7f85bb13 100644 --- a/src/renderer/app/components/modals/UtilitiesModel/SettingsTab/components/InputConfig.tsx +++ b/src/renderer/app/components/modals/UtilitiesModel/SettingsTab/components/InputConfig.tsx @@ -24,7 +24,7 @@ class InputConfig extends React.PureComponent { invalid: false }; - private saveDebounced: (event: React.ChangeEvent) => void; + private saveDebounced: (value: string) => void; constructor(props: Props) { super(props); @@ -32,11 +32,9 @@ class InputConfig extends React.PureComponent { this.saveDebounced = debounce(this.handleChange.bind(this), 50); } - handleChange = (event: React.FormEvent) => { + handleChange = (value: string) => { const { configKey, onChange, setConfigKey } = this.props; - const value = event.currentTarget.value; - if (onChange) { onChange(value, () => { setConfigKey(configKey, value); @@ -66,7 +64,7 @@ class InputConfig extends React.PureComponent { 'is-invalid': invalid })} name={name} - onChange={this.saveDebounced} + onChange={(event: React.ChangeEvent) => this.saveDebounced(event.target.value)} placeholder={usePlaceholder ? name : undefined} defaultValue={value || ''} />