fix default tags with sync

This commit is contained in:
Sean Yesmunt 2019-09-10 15:44:16 -04:00
parent 45031668f0
commit 220b717fc1
2 changed files with 4 additions and 20 deletions

10
dist/bundle.es.js vendored
View file

@ -4465,7 +4465,7 @@ function getDefaultKnownTags() {
} }
const defaultState$8 = { const defaultState$8 = {
followedTags: DEFAULT_FOLLOWED_TAGS, followedTags: [],
knownTags: getDefaultKnownTags() knownTags: getDefaultKnownTags()
}; };
@ -4512,18 +4512,12 @@ const tagsReducer = handleActions({
followedTags: newFollowedTags 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) => { [USER_SETTINGS_POPULATE]: (state, action) => {
const { tags } = action.data; const { tags } = action.data;
let newTags; let newTags;
if (!tags) { if (!tags) {
newTags = state.followedTags; newTags = state.followedTags || DEFAULT_FOLLOWED_TAGS;
} else { } else {
if (!state.followedTags || !state.followedTags.length) { if (!state.followedTags || !state.followedTags.length) {
newTags = tags; newTags = tags;

View file

@ -14,7 +14,7 @@ function getDefaultKnownTags() {
} }
const defaultState: TagState = { const defaultState: TagState = {
followedTags: DEFAULT_FOLLOWED_TAGS, followedTags: [],
knownTags: getDefaultKnownTags(), knownTags: getDefaultKnownTags(),
}; };
@ -65,16 +65,6 @@ export const tagsReducer = handleActions(
followedTags: newFollowedTags, followedTags: newFollowedTags,
}; };
}, },
USER_SETTINGS_POPULATE: (
state: TagState,
action: { data: { app: { tags: Array<string> } } }
) => {
// const tags = getValueFromSettingsSync('tags', action.data);
return {
...state,
followedTags: (action.data && action.data.app && action.data.app.tags) || [],
};
},
[ACTIONS.USER_SETTINGS_POPULATE]: ( [ACTIONS.USER_SETTINGS_POPULATE]: (
state: TagState, state: TagState,
action: { data: { tags: ?Array<string> } } action: { data: { tags: ?Array<string> } }
@ -83,7 +73,7 @@ export const tagsReducer = handleActions(
let newTags; let newTags;
if (!tags) { if (!tags) {
newTags = state.followedTags; newTags = state.followedTags || DEFAULT_FOLLOWED_TAGS;
} else { } else {
if (!state.followedTags || !state.followedTags.length) { if (!state.followedTags || !state.followedTags.length) {
newTags = tags; newTags = tags;