Fix column of undefined

This commit is contained in:
Bruno Lemos
2018-11-02 20:21:25 -03:00
parent 3455349f46
commit fbc327def4
5 changed files with 5 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ export const columnsReducer: Reducer<State> = (
switch (action.type) {
case REHYDRATE as any:
return immer(state, draft => {
const columns = columnsSelector(action.payload as any)
const columns = columnsSelector((action.payload as any) || {})
draft.columns = columns || []
draft.columns = draft.columns.filter(c => c && c.id)

View File

@@ -1,6 +1,6 @@
import { RootState } from '../../types'
const s = (state: RootState) => state.auth
const s = (state: RootState) => state.auth || {}
export const errorSelector = (state: RootState) => s(state).error

View File

@@ -1,5 +1,5 @@
import { RootState } from '../../types'
const s = (state: RootState) => state.columns
const s = (state: RootState) => state.columns || {}
export const columnsSelector = (state: RootState) => s(state).columns

View File

@@ -4,7 +4,7 @@ import { loadTheme } from '../../styles/utils'
import { RootState } from '../../types'
import { isNight } from '../../utils/helpers/shared'
const s = (state: RootState) => state.config
const s = (state: RootState) => state.config || {}
export const themePairSelector = (state: RootState) => s(state).theme

View File

@@ -1,6 +1,6 @@
import { RootState } from '../../types'
const s = (state: RootState) => state.navigation
const s = (state: RootState) => state.navigation || {}
export const modalStack = (state: RootState) => s(state).modalStack