From 220b717fc123c0f436fb534b0d6bbe000568f710 Mon Sep 17 00:00:00 2001 From: Sean Yesmunt Date: Tue, 10 Sep 2019 15:44:16 -0400 Subject: [PATCH] fix default tags with sync --- dist/bundle.es.js | 10 ++-------- src/redux/reducers/tags.js | 14 ++------------ 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index bf6be70..0e5ee26 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -4465,7 +4465,7 @@ function getDefaultKnownTags() { } const defaultState$8 = { - followedTags: DEFAULT_FOLLOWED_TAGS, + followedTags: [], knownTags: getDefaultKnownTags() }; @@ -4512,18 +4512,12 @@ const tagsReducer = handleActions({ followedTags: newFollowedTags }); }, - USER_SETTINGS_POPULATE: (state, action) => { - // const tags = getValueFromSettingsSync('tags', action.data); - return _extends$d({}, state, { - followedTags: action.data && action.data.app && action.data.app.tags || [] - }); - }, [USER_SETTINGS_POPULATE]: (state, action) => { const { tags } = action.data; let newTags; if (!tags) { - newTags = state.followedTags; + newTags = state.followedTags || DEFAULT_FOLLOWED_TAGS; } else { if (!state.followedTags || !state.followedTags.length) { newTags = tags; diff --git a/src/redux/reducers/tags.js b/src/redux/reducers/tags.js index 759a894..29480e1 100644 --- a/src/redux/reducers/tags.js +++ b/src/redux/reducers/tags.js @@ -14,7 +14,7 @@ function getDefaultKnownTags() { } const defaultState: TagState = { - followedTags: DEFAULT_FOLLOWED_TAGS, + followedTags: [], knownTags: getDefaultKnownTags(), }; @@ -65,16 +65,6 @@ export const tagsReducer = handleActions( followedTags: newFollowedTags, }; }, - USER_SETTINGS_POPULATE: ( - state: TagState, - action: { data: { app: { tags: Array } } } - ) => { - // const tags = getValueFromSettingsSync('tags', action.data); - return { - ...state, - followedTags: (action.data && action.data.app && action.data.app.tags) || [], - }; - }, [ACTIONS.USER_SETTINGS_POPULATE]: ( state: TagState, action: { data: { tags: ?Array } } @@ -83,7 +73,7 @@ export const tagsReducer = handleActions( let newTags; if (!tags) { - newTags = state.followedTags; + newTags = state.followedTags || DEFAULT_FOLLOWED_TAGS; } else { if (!state.followedTags || !state.followedTags.length) { newTags = tags;