Hello all,
I am trying to create a gadget app for the Jira cloud using the Forge UI kit.
It works pretty well with the Jira dashboard gadget module and DashboardGadget + DashboardGadgetEdit components.
I am experiencing unexpected behavior when the configuration is saved and the gadget is rendered, i.e. the change from DashboardGadgetEdit to DashboardGadget component. It looks like the gadget is rendered with the blank configuration and shortly (second) it is refreshed with the new data.
By blank configuration I mean that gadgetConfiguration
variable in this simplified snippet below equals to {}
.
const MyDashboardComponent = () => {
const { extensionContext: { gadgetConfiguration = {} } } = useProductContext();
// ...
return (<Fragment> ... </Fragment>)
}
export const run = render(<MyDashboardComponent />)
I also noticed in my forge tunnel console that gadget function is executed three times after saving the configuration:
invocation: 9da2b20ef90c21e9 gadget-edit.run
invocation: c20db4e38ed422af gadget.run
invocation: 087874df8bd230c5 gadget.run
invocation: d5d7e68bc390f887 gadget.run
I think these two (blank configuration and multiple executions) might be related each other.
gadget-edit.run
and gadget.run
comes probably from manifest.yml
where my functions are configured like this:
modules:
function:
- key: gadget-function
handler: gadget.run
- key: gadget-edit-function
handler: gadget-edit.run
Am I doing something wrong, or there is something wrong with the gadget refresh functionality?
Best regards,
Karol