Bug in custom component - open page not working

Hi, i created a custom component. this custom component has a button. This button has a logic of opening a page when tapped. the pageId is a property managed by the main page where this custom component is used. on the main page, i set up this property on the main page, but when the page opens, it points to an empty id, thus leading to an error. if i do directly with a simple button, it zorks. any idea ?
Thanks !

Hi, the issue here is that the component is not aware of the larger app context and thus cannot open the correct page from inside itself. If you want to trigger an app-level logic from inside a component, you’ll have to expose it to the app context outside of template editor:

  1. In component template editor, add a new event for the component:

  1. Set that event to trigger when button inside of component is tapped:

  1. On the component’s logic canvas outside of template editor, use “Receive event” node to listen to the event you just created:

  1. Add a subsequent “Open page” flow:

ooooh wonderful, that works !
so indeed, you cannot launch events from inside the component template, but only trigger “an event”, and manage that event from outside the template in the main app. not sure if what i’m saying is clear :smiley:
but that’s not very intuitive. in this case, appgyver should block flows from inside the component template that do not work, and allow only trigger event. if i had only that event available, i would have a clue of how this should work.
thanks so much for your feedback

1 Like

Hi, exactly so – the components are meant to be reusable, so anything context-dependent is better done outside of them. And thanks for the feedback, hiding the navigation flows here would be a good idea. :slight_smile: