dspace-angular
dspace-angular copied to clipboard
Simplified ThemedComponent by using Angular's new built-in setInput()
References
- Related #2235
Description
Since Angular 14.1.0 it is now possible to update the @Input()s on a ComponentRef using the method setInput(). This has some advantages, because now it automatically calls the ngOnChanges method, marks the changes as dirty and fixture.whenStable() now also waits for the fixture to be stable in child components, so by using this we can simplify our code.
Instructions for Reviewers
List of changes in this PR:
- To achieve this the
inAndOutputNameshad to be split into 2 separate arrays (this was already done in PR #2339 for the loader components) - Because Angular also keeps a list of all the
@Input()s &@Output()s and that we can easily forget to manually sync this list, I removed all those lists in the themed components and used Angular's lists instead. - I did leave the old
inAndOutputNameslist in theThemedComponentfor the moment (can probably be removed for 9.0) and put in on private on purpose, so that it throws a compilation error if one is still present in a themed component
Checklist
- [x] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
- [x] My PR passes ESLint validation using
yarn lint - [x] My PR doesn't introduce circular dependencies (verified via
yarn check-circ-deps) - [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
- [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
- [x] If my PR includes new libraries/dependencies (in
package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation. - [x] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
- [x] If my PR fixes an issue ticket, I've linked them together.
Hi @alexandrevryghem, Conflicts have been detected against the base branch. Please resolve these conflicts as soon as you can. Thanks!
@alexandrevryghem : This has code conflicts. If you wish to have it still considered for 8.0, please get this PR cleaned up and updated to latest main. Otherwise, we'll have to reschedule for 9.0. Thanks!