vendure
vendure copied to clipboard
Inconsistent usage of functions
Describe the bug
The functions used in these two files are not consistent:
https://github.com/vendure-ecommerce/vendure/blob/master/packages/admin-ui/src/lib/core/src/common/base-list.component.ts
Used: ngOnInit()
& ngOnDestroy()
https://github.com/vendure-ecommerce/vendure/blob/master/packages/admin-ui/src/lib/core/src/common/base-detail.component.ts
Used: init()
& destroy()
Expected behavior
Both components use either ngOnInit()
& ngOnDestroy()
or init()
& destroy()
.
I prefer the Angular functions in this case because you can just call super.ngOnInit()
if you want to add something to the init function (The super.ngOnInit()
is even added automatically by my IDE if I add the ngOnInit()
function to a component). Also, you don't have to call an init function manually if you don't want to initialize anything extra yourself, because Angular calls the ngOnInit
function automatically by itself.
Environment (please complete the following information):
- @vendure/core version: 1.3.4
Hi,
This is a good point, and I agree that they should both use the Angular hooks. This would be a breaking change so I'll mark it for the next major version.