daelmaak / ngx-gallery

Homepage
https://daelmaak.github.io/ngx-gallery/
Apache License 2.0
15 stars 4 forks source link

fix: make `items` always defined #98

Closed daelmaak closed 11 months ago

daelmaak commented 11 months ago

The whole codebase relies on items being always defined yet this contract was broken in v3 release.

I use ngOnChanges since a simple default field value is not enough in cases where undefined is assigned to GalleryComponent explicitly.

In the test I started using setInput which, unlike simple assignment, correctly runs ngOnChanges and marks even OnPush component for check. The default ng's interface for the method is poor however as there is no keyof Component checking so I provided my own to cover this blind spot.