Duplicated components generated on module load when component is located within Panel Card Expanded Header Components Area

Typically, when I add a component in app studio, and put an onCreate event on it, it’ll fire once. With more than one dashboard I’m working on, I noted that the onCreate event is firing twice. Enabling debug and using hotkey ctrl-alt-L to display all components/properties shows me there are two instances of the component being created by Kinetic on form load:



Note that the GUID/id of the component is the same, also if I check the output from the GetApp REST call, i don’t see a duplicate instance of this component on the layout. It looks like Kinetic is creating a duplicate copy when building the UI. Anyone run into this before or have an idea what might trigger it? Off to report another bug with App Studio!

1 Like

Further testing looks like this is applicable to any component located within a Panel Card’s “Expanded Header Components” area (the container above the main panel card area)
Dragging the component into the main panel card area creates only one instance of the component.
Dragging the same component into the extended header components area causes kinetic to generate a duplicate of the component.
Testing shows that both are rendered and active, if i use control-alt-L to change hidden to true on one of them, it will still remain visible. I have to change hidden to true on both of them for it to hide. onCreate events will fire once when the component is contained within the Panel Card, and twice when the component is contained with the Panel Card’s Expanded Header Component area.

Copy/Paste of my repro steps in case anyone wants to take a peek.

Repro Steps:

  • Open Application Studio

  • Hit “+” icon for a new app

  • Choose Manual, hit OK

  • Type: Dashboard Id: anything

  • Click “Dashboard Template” and then the Pencil icon

  • From the Toolbox, drag a Panel Card component to the page.

  • From the Toolbox, drag a Container component into the panel card’s lower section.

  • From the Toolbox, drag a Button component into the container located within the panel card’s lower section.

  • Click the Button, navigate to “Properties” on the right column.

  • Expand “Behavior”, click “On Create”

  • From the Toolbox, drag a kinetic-message-handler component into the Generated Event.

  • Click the kinetic-message-handler component and Navigate to properties on the right column.

  • Expand “Advanced” and click “Param”

  • Input the following:

    • Type: Toast
    • Level: info
    • Message: This will display once in thepanel card lower section and twice in the panel card upper section.
    • Buttons: ok
  • Click the “Play” button in the upper right corner of app studio to preview the app.

  • You should see a single toast popup.

  • Now, switch browser tabs back to the Dashboard Template/App Studio tab.

  • Navigate to the “Dashboard Template” page tab within app studio.

  • Drag the Button component into the “Expanded Header Components” area on top of the Panel Card.

  • Click the “Play” button in the upper right corner of app studio to preview the app.

  • You should see two toast popups, as the component has been generated twice by App Studio.

  • This can be verified by pressing control-alt-8 to switch into debug mode, and control-alt-L to display components in the debug mode console, then pressing F12 to open dev tools, and navigating to the “Console” tab.

  • You will see duplicate instances of the button, in the properties for each instance, you will see componentInstance._autoIdNum and componentInstance.ngContext differ for each instance of the component.

Furthermore, behavior of the panel card is such that if you click the up-arrow icon to “roll up” the panel, all components within it get destroyed. (the only component present on the page after a panel roll-up is the panel card)
Clicking the down arrow icon to expand the panel card will create the components on-the-fly, which fires the component’s onCreate trigger again.
With this duplicating behavior, only one instance of the component is destroyed and created on the unexpand/expand action, so the duplicate onCreate event only fires twice during initial form load. rolling up the panel card and expanding it again will only fire the event once (as the duplicate copy of the component doesn’t get destroyed/created, so doesn’t fire the event)

1 Like

Have you logged that with support?

Indeed. CS0004838176. Copy pasted the repro steps from my case. Now for the waiting!

1 Like