Skip to content

Commit

Permalink
fix(content): get the first config before listening
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed Apr 21, 2018
1 parent e89eb54 commit 2a6fdf6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/content/redux/modules/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { appConfigFactory, AppConfig } from '@/app-config'
import { addAppConfigListener } from '@/_helpers/config-manager'
import { createAppConfigStream } from '@/_helpers/config-manager'

/*-----------------------------------------------*\
Actions
Expand Down Expand Up @@ -31,7 +31,7 @@ export default function reducer (state = appConfigFactory(), action): ConfigStat
type Action = { type: Actions, payload?: any }

/** When app config is updated */
export function newConfig (config): Action {
export function newConfig (config: AppConfig): Action {
return { type: Actions.NEW_CONFIG, payload: config }
}

Expand All @@ -45,6 +45,6 @@ type Dispatcher = (

export function listenConfig (): Dispatcher {
return dispatch => {
addAppConfigListener(({ config }) => dispatch(newConfig(config)))
createAppConfigStream().subscribe(config => dispatch(newConfig(config)))
}
}

0 comments on commit 2a6fdf6

Please sign in to comment.