Skip to content

Commit

Permalink
fix(activation): do not call component reloading twice on activation (#…
Browse files Browse the repository at this point in the history
…1516)

* fix(activation): do not call component reloading twice on activation

* chore(activation tests): fix tests

* chore(changelog): add changelog
  • Loading branch information
gretzkiy authored Dec 13, 2024
1 parent 80824b2 commit 9d02a54
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions src/components/super/i-block/modules/activation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/components/super/i-block/modules/activation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ test.describe('<i-block> 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);
});
});

Expand Down

0 comments on commit 9d02a54

Please sign in to comment.