From 9d02a5404df7cef92e6f207e2f65398970ee97e9 Mon Sep 17 00:00:00 2001 From: Andrey Dikarev <32389251+gretzkiy@users.noreply.github.com> Date: Fri, 13 Dec 2024 13:46:00 +0300 Subject: [PATCH] fix(activation): do not call component reloading twice on activation (#1516) * fix(activation): do not call component reloading twice on activation * chore(activation tests): fix tests * chore(changelog): add changelog --- CHANGELOG.md | 6 ++++++ .../super/i-block/modules/activation/CHANGELOG.md | 6 ++++++ src/components/super/i-block/modules/activation/index.ts | 3 ++- .../super/i-block/modules/activation/test/unit/reload.ts | 4 +--- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 097b267c5..8a3fe393c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ Changelog _Note: Gaps between patch versions are faulty, broken or test releases._ +## v4.0.0-beta.168 (2024-12-13) + +#### :bug: Bug Fix + +* Call component's `reload` just once on reactivation `components/super/i-block/modules/activation` + ## v4.0.0-beta.167 (2024-12-12) #### :bug: Bug Fix diff --git a/src/components/super/i-block/modules/activation/CHANGELOG.md b/src/components/super/i-block/modules/activation/CHANGELOG.md index 1bc82e8d3..d8cacdc6a 100644 --- a/src/components/super/i-block/modules/activation/CHANGELOG.md +++ b/src/components/super/i-block/modules/activation/CHANGELOG.md @@ -9,6 +9,12 @@ Changelog > - :house: [Internal] > - :nail_care: [Polish] +## v4.0.0-beta.168 (2024-12-13) + +#### :bug: Bug Fix + +* Call component's `reload` just once on reactivation + ## v4.0.0-beta.153 (2024-11-15) #### :house: Internal diff --git a/src/components/super/i-block/modules/activation/index.ts b/src/components/super/i-block/modules/activation/index.ts index ebfd2d635..21c3cee90 100644 --- a/src/components/super/i-block/modules/activation/index.ts +++ b/src/components/super/i-block/modules/activation/index.ts @@ -180,7 +180,8 @@ export function onActivated(component: iBlock, force: boolean = false): void { if (needInitLoadOrReload) { const group = {group: 'requestSync:get'}; - async.forEach(($a) => $a.clearAll(group).setImmediate(load, group)); + async.forEach(($a) => $a.clearAll(group)); + unsafe.async.setImmediate(load, group); } if (unsafe.isReadyOnce) { diff --git a/src/components/super/i-block/modules/activation/test/unit/reload.ts b/src/components/super/i-block/modules/activation/test/unit/reload.ts index d352a525a..5097d77a7 100644 --- a/src/components/super/i-block/modules/activation/test/unit/reload.ts +++ b/src/components/super/i-block/modules/activation/test/unit/reload.ts @@ -60,9 +60,7 @@ test.describe(' modules - reload', () => { await ctx.waitComponentStatus('ready'); }); - // We expect that the reload method will be called twice, - // since we are going through two instances of `async` and `$async` in the array - await test.expect(mockReload.callsCount).resolves.toBe(2); + await test.expect(mockReload.callsCount).resolves.toBe(1); }); });