diff --git a/CHANGELOG.md b/CHANGELOG.md index 52e2da3..907171a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased][] +### Fixed + +#### Breaking Change + +- 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. + +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. + ## [3.0.0][] - 2021-07-23 ### Added diff --git a/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.spec.ts b/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.spec.ts index 8980e0b..a858197 100644 --- a/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.spec.ts +++ b/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.spec.ts @@ -54,13 +54,4 @@ describe('NgxSkeletonLoaderModule method', () => { // tslint:disable-next-line: no-console expect(console.info).toHaveBeenCalledTimes(0); }); - - describe('When the module loaded twice asynchronously in a submodule', () => { - it('should throw an error if the module was previously loaded', () => { - expect(() => new NgxSkeletonLoaderModule(new NgxSkeletonLoaderModule())).toThrowError( - // tslint:disable-next-line: max-line-length - '`NgxSkeletonLoaderModule` is already loaded and it might cause issues. To avoid that, import the module only once in your app.', - ); - }); - }); }); diff --git a/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts b/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts index f7a2273..b5e26d4 100644 --- a/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts +++ b/projects/ngx-skeleton-loader/src/lib/ngx-skeleton-loader.module.ts @@ -1,4 +1,4 @@ -import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core'; +import { ModuleWithProviders, NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { NgxSkeletonLoaderComponent } from './ngx-skeleton-loader.component'; @@ -10,14 +10,6 @@ import { NgxSkeletonLoaderConfig, NGX_SKELETON_LOADER_CONFIG } from './ngx-skele exports: [NgxSkeletonLoaderComponent], }) export class NgxSkeletonLoaderModule { - constructor(@Optional() @SkipSelf() parentModule?: NgxSkeletonLoaderModule) { - if (parentModule) { - throw new Error( - `\`NgxSkeletonLoaderModule\` is already loaded and it might cause issues. To avoid that, import the module only once in your app.`, - ); - } - } - static forRoot(config?: Partial): ModuleWithProviders { return { ngModule: NgxSkeletonLoaderModule,