Skip to content
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.

Commit

Permalink
fix(SettingsFactory): settings of components are now deep merged
Browse files Browse the repository at this point in the history
  • Loading branch information
valentingavran committed May 24, 2022
1 parent 7f02ab7 commit 25608e3
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 13 deletions.
3 changes: 2 additions & 1 deletion libs/anglify/src/factories/settings.factory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { inject, InjectFlags, InjectionToken, Provider } from '@angular/core';
import { deepmerge } from 'deepmerge-ts';

/**
*
Expand All @@ -12,7 +13,7 @@ export function createSettingsProvider<T>(name: string, defaultValues: T, settin
provide: name,
useFactory: () => {
const overwrittenSettings = inject<InjectionToken<any>>(settingsToken, InjectFlags.Optional);
return { ...defaultValues, ...overwrittenSettings };
return deepmerge(defaultValues, overwrittenSettings ?? {});
},
};
}
46 changes: 35 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
"@ngneat/until-destroy": "^9.2.0",
"@nrwl/angular": "^14.1.4",
"common-tags": "^1.8.2",
"deepmerge-ts": "^4.0.3",
"ngx-highlightjs": "^6.1.2",
"ngx-markdown": "^13.1.0",
"rxjs": "^7.5.5",
"ts-deepmerge": "^2.0.1",
"tslib": "^2.4.0",
"zone.js": "^0.11.5"
},
Expand Down

0 comments on commit 25608e3

Please sign in to comment.