cozy-harvest-lib 9.32.3 → 9.32.4

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [9.32.4](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.3...cozy-harvest-lib@9.32.4) (2022-12-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Do not use CozyRealtime.unsubscribeAll anymore ([dc6d942](https://github.com/cozy/cozy-libs/commit/dc6d9423a4b49d5e11ddb6c7620cca9541c22519))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [9.32.3](https://github.com/cozy/cozy-libs/compare/cozy-harvest-lib@9.32.2...cozy-harvest-lib@9.32.3) (2022-12-05)
7
18
 
8
19
 
@@ -364,7 +364,7 @@ function registerRealtime(_ref4) {
364
364
  var realtime = client.plugins.realtime;
365
365
  realtime.subscribe('notified', 'io.cozy.accounts', OAUTH_REALTIME_CHANNEL, handleRealtime(konnector, resolve));
366
366
  return function () {
367
- return realtime.unsubscribeAll();
367
+ return realtime.unsubscribe('notified', 'io.cozy.accounts', OAUTH_REALTIME_CHANNEL, handleRealtime(konnector, resolve));
368
368
  };
369
369
  };
370
370
  }
@@ -37,7 +37,7 @@ function CozyRealtimeMock() {
37
37
  this.subscribe = jest.fn().mockImplementation(function (eventType, doctype, channel, fn) {
38
38
  _this.on(eventType + doctype + channel, fn);
39
39
  });
40
- this.unsubscribeAll = jest.fn().mockImplementation(function () {
40
+ this.unsubscribe = jest.fn().mockImplementation(function () {
41
41
  _this.removeAllListeners();
42
42
  });
43
43
 
@@ -50,7 +50,7 @@ function CozyRealtimeMock() {
50
50
 
51
51
  _this.subscribe.mockClear();
52
52
 
53
- _this.unsubscribeAll.mockClear();
53
+ _this.unsubscribe.mockClear();
54
54
  };
55
55
  }
56
56
 
@@ -1089,9 +1089,15 @@ export var ConnectionFlow = /*#__PURE__*/function () {
1089
1089
  this.unsubscribeAllRealtime = function () {
1090
1090
  _this3.jobWatcher.unsubscribeAll();
1091
1091
 
1092
- _this3.realtime.unsubscribeAll();
1092
+ _this3.unsubscribeAllConnectionFlowRealtime();
1093
1093
  };
1094
1094
  }
1095
+ }, {
1096
+ key: "unsubscribeAllConnectionFlowRealtime",
1097
+ value: function unsubscribeAllConnectionFlowRealtime() {
1098
+ this.realtime.unsubscribe('updated', JOBS_DOCTYPE, this.handleTriggerJobUpdated);
1099
+ this.realtime.unsubscribe('updated', JOBS_DOCTYPE, this.job._id, this.handleCurrentJobUpdated.bind(this));
1100
+ }
1095
1101
  }, {
1096
1102
  key: "unwatch",
1097
1103
  value: function unwatch() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-harvest-lib",
3
- "version": "9.32.3",
3
+ "version": "9.32.4",
4
4
  "description": "Provides logic, modules and components for Cozy's harvest applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -91,5 +91,5 @@
91
91
  "react-router-dom": "^5.0.1"
92
92
  },
93
93
  "sideEffects": false,
94
- "gitHead": "2fd687303ab3f8627577806ba20607989e4c13f2"
94
+ "gitHead": "e05c102ddedafe5162d5f01f398c0d9655340321"
95
95
  }
@@ -256,7 +256,13 @@ function registerRealtime({ client, konnector }) {
256
256
  OAUTH_REALTIME_CHANNEL,
257
257
  handleRealtime(konnector, resolve)
258
258
  )
259
- return () => realtime.unsubscribeAll()
259
+ return () =>
260
+ realtime.unsubscribe(
261
+ 'notified',
262
+ 'io.cozy.accounts',
263
+ OAUTH_REALTIME_CHANNEL,
264
+ handleRealtime(konnector, resolve)
265
+ )
260
266
  }
261
267
  }
262
268
 
@@ -30,7 +30,7 @@ function CozyRealtimeMock() {
30
30
  .mockImplementation((eventType, doctype, channel, fn) => {
31
31
  this.on(eventType + doctype + channel, fn)
32
32
  })
33
- this.unsubscribeAll = jest.fn().mockImplementation(() => {
33
+ this.unsubscribe = jest.fn().mockImplementation(() => {
34
34
  this.removeAllListeners()
35
35
  })
36
36
 
@@ -41,7 +41,7 @@ function CozyRealtimeMock() {
41
41
  this.clear = () => {
42
42
  this.removeAllListeners()
43
43
  this.subscribe.mockClear()
44
- this.unsubscribeAll.mockClear()
44
+ this.unsubscribe.mockClear()
45
45
  }
46
46
  }
47
47
  MicroEE.mixin(CozyRealtimeMock)
@@ -710,10 +710,25 @@ export class ConnectionFlow {
710
710
 
711
711
  this.unsubscribeAllRealtime = () => {
712
712
  this.jobWatcher.unsubscribeAll()
713
- this.realtime.unsubscribeAll()
713
+ this.unsubscribeAllConnectionFlowRealtime()
714
714
  }
715
715
  }
716
716
 
717
+ unsubscribeAllConnectionFlowRealtime() {
718
+ this.realtime.unsubscribe(
719
+ 'updated',
720
+ JOBS_DOCTYPE,
721
+ this.handleTriggerJobUpdated
722
+ )
723
+
724
+ this.realtime.unsubscribe(
725
+ 'updated',
726
+ JOBS_DOCTYPE,
727
+ this.job._id,
728
+ this.handleCurrentJobUpdated.bind(this)
729
+ )
730
+ }
731
+
717
732
  unwatch() {
718
733
  if (typeof this.unsubscribeAllRealtime === 'function') {
719
734
  this.unsubscribeAllRealtime()