From b5cb3759e793f68e8c851fb1833ea10e6e8ffbdd Mon Sep 17 00:00:00 2001 From: zeppi Date: Sun, 1 Aug 2021 16:58:45 -0400 Subject: [PATCH] U_S_P edited collection bugfix sync edited --- dist/bundle.es.js | 14 ++++++++++++-- src/redux/actions/sync.js | 5 +++++ src/redux/reducers/collections.js | 8 +++++++- src/redux/selectors/collections.js | 1 + 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 811722d..ede5612 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1868,11 +1868,12 @@ function extractUserState(rawObj) { app_welcome_version, sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections } = rawObj.value; - return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swap_codes ? { coin_swap_codes } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}, unpublishedCollections ? { unpublishedCollections } : {}, builtinCollections ? { builtinCollections } : {}, savedCollections ? { savedCollections } : {}); + return _extends$1({}, subscriptions ? { subscriptions } : {}, following ? { following } : {}, tags ? { tags } : {}, blocked ? { blocked } : {}, coin_swap_codes ? { coin_swap_codes } : {}, settings ? { settings } : {}, app_welcome_version ? { app_welcome_version } : {}, sharing_3P ? { sharing_3P } : {}, unpublishedCollections ? { unpublishedCollections } : {}, editedCollections ? { editedCollections } : {}, builtinCollections ? { builtinCollections } : {}, savedCollections ? { savedCollections } : {}); } return {}; @@ -1890,6 +1891,7 @@ function doPopulateSharedUserState(sharedSettings) { app_welcome_version, sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections } = extractUserState(sharedSettings); @@ -1905,6 +1907,7 @@ function doPopulateSharedUserState(sharedSettings) { welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections } @@ -3702,6 +3705,7 @@ const makeSelectClaimUrlInCollection = url => reselect.createSelector(selectBuil const itemsInCollections = []; collections.map(list => { Object.entries(list).forEach(([key, value]) => { + // $FlowFixMe value.items.map(item => { itemsInCollections.push(item); }); @@ -7776,8 +7780,14 @@ const collectionsReducer = handleActions({ })); }, [USER_STATE_POPULATE]: (state, action) => { - const { builtinCollections, savedCollections, unpublishedCollections } = action.data; + const { + builtinCollections, + savedCollections, + unpublishedCollections, + editedCollections + } = action.data; return _extends$e({}, state, { + edited: editedCollections || state.edited, unpublished: unpublishedCollections || state.unpublished, builtin: builtinCollections || state.builtin, saved: savedCollections || state.saved diff --git a/src/redux/actions/sync.js b/src/redux/actions/sync.js index 032a8ab..3808004 100644 --- a/src/redux/actions/sync.js +++ b/src/redux/actions/sync.js @@ -14,6 +14,7 @@ type SharedData = { app_welcome_version?: number, sharing_3P?: boolean, unpublishedCollections: CollectionGroup, + editedCollections: CollectionGroup, builtinCollections: CollectionGroup, savedCollections: Array, }, @@ -31,6 +32,7 @@ function extractUserState(rawObj: SharedData) { app_welcome_version, sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections, } = rawObj.value; @@ -45,6 +47,7 @@ function extractUserState(rawObj: SharedData) { ...(app_welcome_version ? { app_welcome_version } : {}), ...(sharing_3P ? { sharing_3P } : {}), ...(unpublishedCollections ? { unpublishedCollections } : {}), + ...(editedCollections ? { editedCollections } : {}), ...(builtinCollections ? { builtinCollections } : {}), ...(savedCollections ? { savedCollections } : {}), }; @@ -65,6 +68,7 @@ export function doPopulateSharedUserState(sharedSettings: any) { app_welcome_version, sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections, } = extractUserState(sharedSettings); @@ -80,6 +84,7 @@ export function doPopulateSharedUserState(sharedSettings: any) { welcomeVersion: app_welcome_version, allowAnalytics: sharing_3P, unpublishedCollections, + editedCollections, builtinCollections, savedCollections, }, diff --git a/src/redux/reducers/collections.js b/src/redux/reducers/collections.js index acd4fa7..1bcb347 100644 --- a/src/redux/reducers/collections.js +++ b/src/redux/reducers/collections.js @@ -158,9 +158,15 @@ const collectionsReducer = handleActions( }); }, [ACTIONS.USER_STATE_POPULATE]: (state, action) => { - const { builtinCollections, savedCollections, unpublishedCollections } = action.data; + const { + builtinCollections, + savedCollections, + unpublishedCollections, + editedCollections, + } = action.data; return { ...state, + edited: editedCollections || state.edited, unpublished: unpublishedCollections || state.unpublished, builtin: builtinCollections || state.builtin, saved: savedCollections || state.saved, diff --git a/src/redux/selectors/collections.js b/src/redux/selectors/collections.js index 2acd22d..6eb68c9 100644 --- a/src/redux/selectors/collections.js +++ b/src/redux/selectors/collections.js @@ -175,6 +175,7 @@ export const makeSelectClaimUrlInCollection = (url: string) => const itemsInCollections = []; collections.map(list => { Object.entries(list).forEach(([key, value]) => { + // $FlowFixMe value.items.map(item => { itemsInCollections.push(item); }); -- 2.45.2