@jetshop/core 6.3.0-alpha.71bb1313 → 6.3.0-alpha.969d77a4
Sign up to get free protection for your applications and to get access to all the features.
- package/hooks/ProductList/ProductListContext.js +15 -8
- package/hooks/ProductList/ProductListContext.js.map +1 -1
- package/hooks/ProductList/product-list-reducer.js +0 -17
- package/hooks/ProductList/product-list-reducer.js.map +1 -1
- package/hooks/ProductList/useProductListItems.js +1 -0
- package/hooks/ProductList/useProductListItems.js.map +1 -1
- package/package.json +1 -1
@@ -14,7 +14,7 @@ import { useMutation, useQuery } from '@apollo/client';
|
|
14
14
|
import useWarningInDev from '@jetshop/core/hooks/useWarningInDev';
|
15
15
|
import productListQueries from '@jetshop/core/data/queries/ProductLists.gql';
|
16
16
|
import productListMutations from '@jetshop/core/data/mutations/productListMutations.gql';
|
17
|
-
import {
|
17
|
+
import { productListMapToArray, PRODUCT_LISTS_KEY, emptyProductLists } from '.';
|
18
18
|
import useAuth from '../../components/AuthContext/useAuth';
|
19
19
|
import { useThunkReducer } from '../useThunkReducer';
|
20
20
|
import { createListAction, deleteListAction, loginAction, refreshAction } from './action-creators';
|
@@ -62,9 +62,9 @@ export const ProductListProvider = function ProductListProvider(_a) {
|
|
62
62
|
requestIdRef }, initialState);
|
63
63
|
const [state, dispatch] = useThunkReducer(reducer, defaultInitialState, (initialState) => init(initialState));
|
64
64
|
const usingLocalList = !state.loggedIn;
|
65
|
-
usePersistLocalList({ lists: state.lists });
|
65
|
+
usePersistLocalList({ lists: state.lists, usingLocalList });
|
66
66
|
// When localstorage updates, sync it to reducer state
|
67
|
-
useLocalStorageListener({ refresh });
|
67
|
+
useLocalStorageListener({ refresh, usingLocalList });
|
68
68
|
// loginMutation is a mutation to merge product lists
|
69
69
|
const [loginMutation] = useMutation(queries.login);
|
70
70
|
// To be used to fetch all lists of user after login
|
@@ -99,16 +99,23 @@ export const ProductListProvider = function ProductListProvider(_a) {
|
|
99
99
|
return React.createElement(ProductListContext.Provider, Object.assign({ value: value }, rest));
|
100
100
|
};
|
101
101
|
/**
|
102
|
-
* Persist local list to localStorage on every change
|
102
|
+
* Persist local list to localStorage on every change (when not logged in that is)
|
103
103
|
*/
|
104
|
-
function usePersistLocalList({ lists }) {
|
104
|
+
function usePersistLocalList({ lists, usingLocalList }) {
|
105
105
|
const productListArray = productListMapToArray(lists);
|
106
106
|
useEffect(() => {
|
107
|
+
if (!usingLocalList) {
|
108
|
+
localStorage.removeItem(PRODUCT_LISTS_KEY);
|
109
|
+
return;
|
110
|
+
}
|
107
111
|
localStorage.setItem(PRODUCT_LISTS_KEY, JSON.stringify(productListArray));
|
108
|
-
}, [lists]);
|
112
|
+
}, [lists, productListArray, usingLocalList]);
|
109
113
|
}
|
110
|
-
function useLocalStorageListener({ refresh }) {
|
114
|
+
function useLocalStorageListener({ refresh, usingLocalList }) {
|
111
115
|
useEffect(() => {
|
116
|
+
if (!usingLocalList) {
|
117
|
+
return;
|
118
|
+
}
|
112
119
|
const listener = (e) => {
|
113
120
|
if (e.storageArea === localStorage && e.key === PRODUCT_LISTS_KEY) {
|
114
121
|
refresh();
|
@@ -118,6 +125,6 @@ function useLocalStorageListener({ refresh }) {
|
|
118
125
|
return () => {
|
119
126
|
window.removeEventListener('storage', listener);
|
120
127
|
};
|
121
|
-
}, []);
|
128
|
+
}, [refresh, usingLocalList]);
|
122
129
|
}
|
123
130
|
//# sourceMappingURL=ProductListContext.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ProductListContext.js","sourceRoot":"","sources":["ProductListContext.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAW,SAAS,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAEvD,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,kBAAkB,MAAM,6CAA6C,CAAC;AAC7E,OAAO,oBAAoB,MAAM,uDAAuD,CAAC;AACzF,OAAO,EAEL,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,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAE7C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;AAChC,CAAC"}
|
@@ -93,23 +93,6 @@ export function init(initialState) {
|
|
93
93
|
if (typeof window === 'undefined') {
|
94
94
|
return initialState;
|
95
95
|
}
|
96
|
-
/**
|
97
|
-
* Migrate any legacy product list to the new format
|
98
|
-
*
|
99
|
-
* TODO Remove this code in next major release!
|
100
|
-
*/
|
101
|
-
const LEGACY_LIST_KEY = 'productList';
|
102
|
-
const legacyListData = JSON.parse(window.localStorage.getItem(LEGACY_LIST_KEY));
|
103
|
-
if (legacyListData) {
|
104
|
-
const defaultList = initialState.lists.get(null);
|
105
|
-
Object.assign(defaultList.items, legacyListData);
|
106
|
-
window.localStorage.removeItem(LEGACY_LIST_KEY);
|
107
|
-
return {
|
108
|
-
lists: initialState.lists,
|
109
|
-
loggedIn: initialState.loggedIn,
|
110
|
-
requestIdRef: initialState.requestIdRef
|
111
|
-
};
|
112
|
-
}
|
113
96
|
const localStorageProductLists = JSON.parse(window.localStorage.getItem(PRODUCT_LISTS_KEY));
|
114
97
|
const lists = (localStorageProductLists &&
|
115
98
|
productListArrayToMap(localStorageProductLists)) ||
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"product-list-reducer.js","sourceRoot":"","sources":["product-list-reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAOjB,qBAAqB,EACtB,MAAM,GAAG,CAAC;AACX,gFAAgF;AAChF,YAAY,EAAE,CAAC;AAEf,MAAM,UAAU,OAAO,CACrB,KAAuB,EACvB,MAA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OAAO;wBACP,mBAAmB,EAAE,aAAa;qBACnC,GACF;aACF,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;AACH,CAAC"}
|
@@ -16,6 +16,7 @@ listId = null, options = {}) {
|
|
16
16
|
// Make a `products` query containing every item in the list
|
17
17
|
const productQueryResult = useQuery(queries.productsQuery, {
|
18
18
|
skip: flattenedList.length === 0,
|
19
|
+
ssr: false,
|
19
20
|
errorPolicy: 'all',
|
20
21
|
variables: {
|
21
22
|
articleNumbers: flattenedList
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useProductListItems.js","sourceRoot":"","sources":["useProductListItems.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjE,OAAO,EACL,WAAW,EACX,uCAAuC,EACxC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,mBAAmB;AACjC,iEAAiE;AACjE,SAAwB,IAAI,EAC5B,UAGI,EAAE;IAEN,MAAM,EACJ,KAAK,EAAE,EAAE,KAAK,EAAE,EAChB,OAAO,EACP,QAAQ,EACR,cAAc,EACf,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAEnC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAE/B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,CAAC,cAAc,CAAC,CAAC;IAE1D,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAE/D,4DAA4D;IAC5D,MAAM,kBAAkB,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