cozy-client 38.9.0 → 38.9.2
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.
- package/dist/CozyClient.js +1 -1
- package/dist/store/queries.js +10 -0
- package/dist/store/queries.spec.js +27 -0
- package/package.json +3 -3
package/dist/CozyClient.js
CHANGED
|
@@ -2677,7 +2677,7 @@ var CozyClient = /*#__PURE__*/function () {
|
|
|
2677
2677
|
CozyClient.hooks = CozyClient.hooks || {};
|
|
2678
2678
|
CozyClient.fetchPolicies = _policies.default; //COZY_CLIENT_VERSION_PACKAGE in replaced by babel. See babel config
|
|
2679
2679
|
|
|
2680
|
-
CozyClient.version = "38.9.
|
|
2680
|
+
CozyClient.version = "38.9.2";
|
|
2681
2681
|
|
|
2682
2682
|
_microee.default.mixin(CozyClient);
|
|
2683
2683
|
|
package/dist/store/queries.js
CHANGED
|
@@ -240,6 +240,16 @@ var query = function query() {
|
|
|
240
240
|
}
|
|
241
241
|
|
|
242
242
|
var count = response.meta && response.meta.count ? response.meta.count : response.data.length;
|
|
243
|
+
|
|
244
|
+
if (action.backgroundFetching) {
|
|
245
|
+
return _objectSpread(_objectSpread(_objectSpread({}, state), common), {}, {
|
|
246
|
+
bookmark: response.bookmark || null,
|
|
247
|
+
hasMore: response.next !== undefined ? response.next : state.hasMore,
|
|
248
|
+
count: count,
|
|
249
|
+
data: response.data.map(_helpers.properId)
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
243
253
|
var fetchedPagesCount = state.fetchedPagesCount + 1;
|
|
244
254
|
var data = updateQueryDataFromResponse(state, response, documents, {
|
|
245
255
|
count: count,
|
|
@@ -111,6 +111,33 @@ describe('queries reducer', () => {
|
|
|
111
111
|
// Then
|
|
112
112
|
expect(state.a.isFetching).toBe(null)
|
|
113
113
|
})
|
|
114
|
+
|
|
115
|
+
it('should override the previous result if the querie is refetched when backgroundFetching is enabled', () => {
|
|
116
|
+
// Given
|
|
117
|
+
const queryDefinition = Q('io.cozy.todos')
|
|
118
|
+
applyAction(initQuery('a', queryDefinition))
|
|
119
|
+
|
|
120
|
+
// When
|
|
121
|
+
applyAction(
|
|
122
|
+
receiveQueryResult('a', {
|
|
123
|
+
data: [TODO_1, TODO_2]
|
|
124
|
+
})
|
|
125
|
+
)
|
|
126
|
+
// Then
|
|
127
|
+
expect(state.a.data).toEqual([TODO_1._id, TODO_2._id])
|
|
128
|
+
|
|
129
|
+
applyAction(
|
|
130
|
+
receiveQueryResult(
|
|
131
|
+
'a',
|
|
132
|
+
{
|
|
133
|
+
data: [TODO_1]
|
|
134
|
+
},
|
|
135
|
+
{ backgroundFetching: true }
|
|
136
|
+
)
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
expect(state.a.data).toEqual([TODO_1._id])
|
|
140
|
+
})
|
|
114
141
|
})
|
|
115
142
|
|
|
116
143
|
describe('RECEIVE_QUERY_ERROR', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-client",
|
|
3
|
-
"version": "38.9.
|
|
3
|
+
"version": "38.9.2",
|
|
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": "^38.
|
|
21
|
+
"cozy-stack-client": "^38.9.2",
|
|
22
22
|
"date-fns": "2.29.3",
|
|
23
23
|
"json-stable-stringify": "^1.0.1",
|
|
24
24
|
"lodash": "^4.17.13",
|
|
@@ -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": "
|
|
76
|
+
"gitHead": "8b852f7d91295fe7353e7e25a33cae4bd0177b98"
|
|
77
77
|
}
|