Skip to content

Commit

Permalink
revert: reverting "feat: preventing multiple calls of forRoot() in …
Browse files Browse the repository at this point in the history
…submodules loaded in async"
  • Loading branch information
willmendesneto committed Jul 29, 2021
1 parent 976e6fe commit 33c159b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
);
});
});
});
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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<NgxSkeletonLoaderConfig>): ModuleWithProviders<NgxSkeletonLoaderModule> {
return {
ngModule: NgxSkeletonLoaderModule,
Expand Down

0 comments on commit 33c159b

Please sign in to comment.