@capillarytech/creatives-library 9.0.61-alpha.2 → 9.0.61
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/package.json
CHANGED
|
@@ -148,11 +148,22 @@ export default [
|
|
|
148
148
|
watchEditTemplate,
|
|
149
149
|
];
|
|
150
150
|
|
|
151
|
+
// Cap + Viber each inject v2ViberSagas; module counter lets only the first task start takeLatest watchers (avoids duplicate API calls).
|
|
152
|
+
let viberSagasActive = 0;
|
|
153
|
+
|
|
151
154
|
export function* v2ViberSagas() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
if (viberSagasActive > 0) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
viberSagasActive += 1;
|
|
159
|
+
try {
|
|
160
|
+
yield all([
|
|
161
|
+
watchUploadViberAsset(),
|
|
162
|
+
watchCreateTemplate(),
|
|
163
|
+
watchGetTemplateDetails(),
|
|
164
|
+
watchEditTemplate(),
|
|
165
|
+
]);
|
|
166
|
+
} finally {
|
|
167
|
+
viberSagasActive -= 1;
|
|
168
|
+
}
|
|
158
169
|
}
|
|
@@ -555,5 +555,26 @@ describe('Viber Sagas', () => {
|
|
|
555
555
|
|
|
556
556
|
describe('v2ViberSagas Combined', () => {
|
|
557
557
|
it('should initialize all Viber-related watcher sagas without error', () => expectSaga(sagas.v2ViberSagas).run());
|
|
558
|
+
|
|
559
|
+
// Double inject (Cap + Viber): only the first task registers watchers.
|
|
560
|
+
it('does not start the watchers again while another task already holds them', () => {
|
|
561
|
+
const first = sagas.v2ViberSagas();
|
|
562
|
+
expect(first.next().done).toBe(false);
|
|
563
|
+
|
|
564
|
+
const second = sagas.v2ViberSagas();
|
|
565
|
+
expect(second.next()).toEqual({ value: undefined, done: true });
|
|
566
|
+
|
|
567
|
+
first.return();
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it('releases the guard when the running task is cancelled, so a remount re-arms', () => {
|
|
571
|
+
const first = sagas.v2ViberSagas();
|
|
572
|
+
expect(first.next().done).toBe(false);
|
|
573
|
+
first.return();
|
|
574
|
+
|
|
575
|
+
const afterCancel = sagas.v2ViberSagas();
|
|
576
|
+
expect(afterCancel.next().done).toBe(false);
|
|
577
|
+
afterCancel.return();
|
|
578
|
+
});
|
|
558
579
|
});
|
|
559
580
|
});
|