[Feedback] Writing a component with sib-core
As our implementation of sib-chat did not works with Converse 5, and due to time drain at debugging it, I rewrote it with firstname.lastname@example.org and I wanted to give you a feedback of trouble that I get.
Overall, there is a lack of documentation on
SIBTemplateElement, even if it does not really do a lot more than an HTMLElement. Example is fine, but only if you want some kind of simple "static widget".
sib-chat, I had no use of template & need to use a shadowRoot for
conversejs, so the use of a
SIBTemplateElement is more a sib-way than a need.
There were two black points:
- I didn't find a simple way to have a
dataSrclike a sib-display & access to a resource within my component, so I directly called the store. Not really handy to use, undocumented too, had to manage with a lot of promises everywhere. Promises are more a converse + sib issue than just a core issue.
- I needed an event "navigate" + "route has binded resource of this component", I did it like this https://git.happy-dev.fr/startinblox/components/sib-chat/blob/sib-chat-next/sib-chat.js#L35-37 but I'm pretty sure we can implement an helper to avoid the use of 1x listener by component instance.
Also some little points:
- navigate event detail.resource had an
idbut not an
@idas expected by
- I used window to set an application wide variable. I know that I can define another component & use it to set my variable, like for sib-auth, but I'm not sure if that's the best way.
- Sometimes, component loads too fast & I get undefined on props, used promises as workaround.
Globally, it's the lack of documentation & way to know what sib-core can / cannot do without having to dig the code that take me most of time beside converse.
Feel free for advice or if you see improvement.