2024 May 09 4:23 PM
Hello there fellow Builders,
TL;DR: Logic attached to the 'component mount' event of a custom-built component doesn't get saved to the component and is not part of the component when that is dragged onto a new location from the components list.
We have reached a certain point in our project where it would make our life so much easier to reuse specific parts of our application that we are now exploring the 'custom component creation', which can be accessed through the 'Create new component' button in the 'properties' tab.
This is a feature that has proven useful several times in the past for me, and we managed to build custom combo boxes, calendars, etc. with this approach. However, today when attempting to create a component that would require custom logic to be executed on a 'component mounted' event we encountered a few issues.
The problem is that when we enter into the 'Component template editor' we have the option to add a 'Receive event' and set it's value to 'Component mounted' as seen below:
Upon saving there are no errors, nothing that would suggest that something is wrong. However, as soon as I close the 'component template' editor the logic canvas remains open and I have the same logic on the 'outside of the component', which was not the case in the past as is definitely not the expected behavior, see below:
Outside the component editor the header should only have the 'component tap' event exposed as that is the only event that is available in the component's properties > events tab. If it was only this visual glitch, I wouldn't raise any issues, but after attempting to drag the custom component onto a different page (or even this one for that matter) the newly added logic will not be part of the component anymore:
This issue was not present in previous Composer / Builder versions, and is in fact, making it impossible to build custom components with custom logic encapsulated as of now.
I would greatly appreciate if someone from the Team or the Community could advise me on a possible solution or ETA.
Have a wonderful day,
Mihály
2024 Jun 06 1:23 PM
The original question didn’t receive many reactions, but I wanted to report back on it since actions have been taken to address the issue.
In the latest Community version update that I noticed yesterday, this issue has been resolved. So a big shoutout to the team!
There have also been some UI improvements within the Composer itself. Creating custom components with encapsulated logic works as expected, and it was super fast to import a component from one app into another with the 'Copy to clipboard' feature.
Just a minor note: if a component uses logic flows that aren’t installed in the target app, those will disappear. So make sure you have all required flows installed before importing a new component.