cozy-client 32.2.4 → 32.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2550,7 +2550,7 @@ var CozyClient = /*#__PURE__*/function () {
2550
2550
  CozyClient.hooks = CozyClient.hooks || {};
2551
2551
  CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
2552
2552
 
2553
- CozyClient.version = "32.2.4";
2553
+ CozyClient.version = "32.2.7";
2554
2554
 
2555
2555
  _microee.default.mixin(CozyClient);
2556
2556
 
@@ -489,14 +489,14 @@ Object {
489
489
  "skip": undefined,
490
490
  "sort": undefined,
491
491
  },
492
- "fetchStatus": "pending",
492
+ "fetchStatus": "loaded",
493
493
  "fetchedPagesCount": 0,
494
494
  "hasMore": false,
495
495
  "id": "b",
496
496
  "lastError": null,
497
497
  "lastErrorUpdate": null,
498
- "lastFetch": null,
499
- "lastUpdate": null,
498
+ "lastFetch": 1337,
499
+ "lastUpdate": 1337,
500
500
  "options": null,
501
501
  },
502
502
  }
@@ -192,7 +192,7 @@ var extractAndMergeDocument = function extractAndMergeDocument(data, updatedStat
192
192
  var id = (0, _helpers.properId)(data);
193
193
 
194
194
  if (mergedData[doctype][id]) {
195
- mergedData[doctype][id] = (0, _merge.default)(mergedData[doctype][id], data);
195
+ mergedData[doctype][id] = (0, _merge.default)({}, mergedData[doctype][id], data);
196
196
  } else {
197
197
  mergedData[doctype][id] = data;
198
198
  }
@@ -148,7 +148,24 @@ describe('extractAndMerge', () => {
148
148
  ).toBeFalsy()
149
149
  }
150
150
  )
151
+ it(
152
+ 'should assign a new object for doctype[id] of document to update' +
153
+ 'in order to allow selector to recompute their data when documents are updated',
154
+ () => {
155
+ const returnedDatas = extractAndMergeDocument(
156
+ data,
157
+ updatedStateWithIncluded
158
+ )
151
159
 
160
+ // Then
161
+ expect(
162
+ returnedDatas['io.cozy.files']['b6ff135b34e041ffb2d4a4865f3e0a53'] ===
163
+ updatedStateWithIncluded['io.cozy.files'][
164
+ 'b6ff135b34e041ffb2d4a4865f3e0a53'
165
+ ]
166
+ ).toBeFalsy()
167
+ }
168
+ )
152
169
  it(
153
170
  'should assign a new object for doctype of document to update' +
154
171
  'even if the mergedData is the same, because reselect createSelector update ' +
@@ -205,10 +205,16 @@ var query = function query() {
205
205
 
206
206
  case RECEIVE_QUERY_RESULT:
207
207
  {
208
- var response = action.response;
208
+ var response = action.response; // Data can be null when we get a 404 not found
209
+ // see Collection.get()
210
+ // but we still need to update the fetchStatus.
209
211
 
210
212
  if (!response.data) {
211
- return state;
213
+ return _objectSpread(_objectSpread({}, state), {}, {
214
+ fetchStatus: 'loaded',
215
+ lastFetch: Date.now(),
216
+ lastUpdate: Date.now()
217
+ });
212
218
  }
213
219
  /** @type {Partial<QueryState>} */
214
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-client",
3
- "version": "32.2.4",
3
+ "version": "32.2.7",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.node.js",
6
6
  "browser": "dist/index.js",
@@ -18,7 +18,7 @@
18
18
  "@types/jest": "^26.0.20",
19
19
  "@types/lodash": "^4.14.170",
20
20
  "btoa": "^1.2.1",
21
- "cozy-stack-client": "^32.2.4",
21
+ "cozy-stack-client": "^32.2.5",
22
22
  "json-stable-stringify": "^1.0.1",
23
23
  "lodash": "^4.17.13",
24
24
  "microee": "^0.0.6",
@@ -73,5 +73,5 @@
73
73
  "react-native-ios11-devicecheck": "https://github.com/cozy/react-native-devicecheck#app-attest-v0.1"
74
74
  },
75
75
  "sideEffects": false,
76
- "gitHead": "8ec78eb5a028f8df4908e283d0d48572d475ab3f"
76
+ "gitHead": "7fface7b6a57f5f98d334162e95b30c94fbc03f1"
77
77
  }