You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm integrating the AuDatePicker component in GN and I noticed some things that can be improved:
Integration issues
At the moment the <duet-date-picker> component doesn't actually work in other projects. The html is rendered, but the web component logic isn't being registered / executed. This addon uses ember-cli-stencil to make stencil web components work automagically, but it is installed as a devDependency which means it's not installed in the host app. It might be possible to simply move it to the dependencies but it would have to be tested.
An alternative could be to create an initializer which does the initialization. The code would look similar to this commit. I think this approach is better since the ember-cli-stencil addon does some very dynamic things which I suspect won't be compatible with Embroider. Since the manual version is so simple I think it makes sense to just sidestep that problem altogether.
Suggested API changes:
The AuDatePicker expects an ISO 8601 formatted date as a value because it is passed through as-is to the <duet-date-picker> component. Since Ember supports arguments of different types than string, I think it would make more sense to support Date instances as well (or only). That way the consuming app doesn't have to convert dates to strings manually.
The same goes for the value that gets passed into the callback function. Returning a Date instance to update a date or undefined / null to clear it would be a nicer DX.
Issues:
Typing in the input field doesn't update the calendar when opened. This does work on the <duet-date-picker> demo page although I haven't looked into the details yet.
Clearing the input field throws an exception because the callBackParent action doesn't handle that yet.
Translations are set when the component is created so to change the translations the component needs to be destroyed first. I think it would be better to convert this logic into a getter so it gets updated if the localization argument changes. Not super important since it will probably not be a problem in practice, but it would make the component more solid.
I'm integrating the AuDatePicker component in GN and I noticed some things that can be improved:
Integration issues
At the moment the
<duet-date-picker>
component doesn't actually work in other projects. The html is rendered, but the web component logic isn't being registered / executed. This addon usesember-cli-stencil
to make stencil web components work automagically, but it is installed as a devDependency which means it's not installed in the host app. It might be possible to simply move it to the dependencies but it would have to be tested.An alternative could be to create an initializer which does the initialization. The code would look similar to this commit. I think this approach is better since the ember-cli-stencil addon does some very dynamic things which I suspect won't be compatible with Embroider. Since the manual version is so simple I think it makes sense to just sidestep that problem altogether.
Suggested API changes:
<duet-date-picker>
component. Since Ember supports arguments of different types than string, I think it would make more sense to supportDate
instances as well (or only). That way the consuming app doesn't have to convert dates to strings manually.Date
instance to update a date or undefined / null to clear it would be a nicer DX.Issues:
<duet-date-picker>
demo page although I haven't looked into the details yet.callBackParent
action doesn't handle that yet.localization
argument changes. Not super important since it will probably not be a problem in practice, but it would make the component more solid.PR for reference: lblod/frontend-gelinkt-notuleren#89
The text was updated successfully, but these errors were encountered: