Browse Source
Update npm/ng-packs/packages/core/src/lib/services/replaceable-components.service.ts
Co-authored-by: Levent Arman Özak <arman@armanozak.com>
pull/5333/head
Mehmet Erim
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
2 additions and
2 deletions
-
npm/ng-packs/packages/core/src/lib/services/replaceable-components.service.ts
|
|
|
@ -43,7 +43,7 @@ export class ReplaceableComponentsService { |
|
|
|
} |
|
|
|
|
|
|
|
add(replaceableComponent: ReplaceableComponents.ReplaceableComponent, reload?: boolean): void { |
|
|
|
let replaceableComponents = this.store.state; |
|
|
|
const replaceableComponents = [...this.store.state]; |
|
|
|
|
|
|
|
const index = replaceableComponents.findIndex( |
|
|
|
component => component.key === replaceableComponent.key, |
|
|
|
@ -52,7 +52,7 @@ export class ReplaceableComponentsService { |
|
|
|
if (index > -1) { |
|
|
|
replaceableComponents[index] = replaceableComponent; |
|
|
|
} else { |
|
|
|
replaceableComponents = [...replaceableComponents, replaceableComponent]; |
|
|
|
replaceableComponents.push(replaceableComponent); |
|
|
|
} |
|
|
|
|
|
|
|
this.store.patch(replaceableComponents); |
|
|
|
|