Skip to content

Commit

Permalink
fix(options): get profile id list on init
Browse files Browse the repository at this point in the history
  • Loading branch information
crimx committed Jan 21, 2019
1 parent 7dc05b6 commit 114ccf0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/options/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class Options extends React.Component<OptionsProps, OptionsState> {
config,
profile,
profileIDList,
rawProfileName: this.getActiveProfileName(profile.id),
rawProfileName: this.getActiveProfileName(profile.id, profileIDList),
})
})

Expand All @@ -102,8 +102,11 @@ export class Options extends React.Component<OptionsProps, OptionsState> {
})
}

getActiveProfileName = (activeID: string): string => {
const activeProfileID = this.state.profileIDList.find(
getActiveProfileName = (
activeID: string,
profileIDList = this.state.profileIDList,
): string => {
const activeProfileID = profileIDList.find(
({ id }) => id === activeID
)
return activeProfileID ? activeProfileID.name : ''
Expand Down

0 comments on commit 114ccf0

Please sign in to comment.