Skip to content

Commit

Permalink
refactor(actions): make SELECT_PHRASE an FSA
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmason committed Oct 12, 2017
1 parent 474ba99 commit 4e89b31
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Expand Up @@ -11,7 +11,7 @@ export const COPY_FROM_SOURCE = 'COPY_FROM_SOURCE'
export const COPY_FROM_ALIGNED_SOURCE = 'COPY_FROM_ALIGNED_SOURCE'
export const CANCEL_EDIT = 'CANCEL_EDIT'
export const UNDO_EDIT = 'UNDO_EDIT'
export const SELECT_PHRASE = Symbol('SELECT_PHRASE')
export const SELECT_PHRASE = 'SELECT_PHRASE'
export const SELECT_PHRASE_SPECIFIC_PLURAL =
Symbol('SELECT_PHRASE_SPECIFIC_PLURAL')
export const PHRASE_TEXT_SELECTION_RANGE = Symbol('PHRASE_TEXT_SELECTION_RANGE')
Expand Down
Expand Up @@ -54,7 +54,7 @@ export const undoEdit = createAction(UNDO_EDIT)
export function selectPhrase (phraseId) {
return (dispatch) => {
dispatch(savePreviousPhraseIfChanged(phraseId))
dispatch({type: SELECT_PHRASE, phraseId})
dispatch(createAction(SELECT_PHRASE)(phraseId))
}
}

Expand Down
Expand Up @@ -218,7 +218,7 @@ export const phraseReducer = (state = defaultState, action) => {
})

case SELECT_PHRASE:
return selectPhrase(state, action.phraseId)
return selectPhrase(state, action.payload)

case SELECT_PHRASE_SPECIFIC_PLURAL:
const withNewPluralIndex = updatePhrase(action.phraseId, {
Expand Down
Expand Up @@ -504,7 +504,7 @@ describe('phrase-reducer test', () => {
})
const selected = phraseReducer(initialState, {
type: SELECT_PHRASE,
phraseId: 'p02',
payload: 'p02',
getState: () => {
return {
context: {
Expand Down

0 comments on commit 4e89b31

Please sign in to comment.