Skip to content

Commit 33c159b

Browse files
revert: reverting "feat: preventing multiple calls of forRoot() in submodules loaded in async"
1 parent 976e6fe commit 33c159b

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased][]
99

10+
### Fixed
11+
12+
#### Breaking Change
13+
14+
- Rolling back "Adding mechanism to prevents calling `forRoot()` more than once if module is loaded asynchronously in a submodule.". Unfortunately, this was affecting consumers and it needed to be reverted to avoid friction in other applications.
15+
16+
If you need to have this feature in place, the suggestion is to create a specific module in your app and apply the changes on your application.
17+
1018
## [3.0.0][] - 2021-07-23
1119

1220
### Added

projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.spec.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,4 @@ describe('NgxSkeletonLoaderModule method', () => {
5454
// tslint:disable-next-line: no-console
5555
expect(console.info).toHaveBeenCalledTimes(0);
5656
});
57-
58-
describe('When the module loaded twice asynchronously in a submodule', () => {
59-
it('should throw an error if the module was previously loaded', () => {
60-
expect(() => new NgxSkeletonLoaderModule(new NgxSkeletonLoaderModule())).toThrowError(
61-
// tslint:disable-next-line: max-line-length
62-
'`NgxSkeletonLoaderModule` is already loaded and it might cause issues. To avoid that, import the module only once in your app.',
63-
);
64-
});
65-
});
6657
});

projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
1+
import { ModuleWithProviders, NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33

44
import { NgxSkeletonLoaderComponent } from './ngx-skeleton-loader.component';
@@ -10,14 +10,6 @@ import { NgxSkeletonLoaderConfig, NGX_SKELETON_LOADER_CONFIG } from './ngx-skele
1010
exports: [NgxSkeletonLoaderComponent],
1111
})
1212
export class NgxSkeletonLoaderModule {
13-
constructor(@Optional() @SkipSelf() parentModule?: NgxSkeletonLoaderModule) {
14-
if (parentModule) {
15-
throw new Error(
16-
`\`NgxSkeletonLoaderModule\` is already loaded and it might cause issues. To avoid that, import the module only once in your app.`,
17-
);
18-
}
19-
}
20-
2113
static forRoot(config?: Partial<NgxSkeletonLoaderConfig>): ModuleWithProviders<NgxSkeletonLoaderModule> {
2214
return {
2315
ngModule: NgxSkeletonLoaderModule,

0 commit comments

Comments
 (0)