Switching to UI Kit 2 (from UI Kit)

Hi,

I created an app in Forge UI Kit and was surprised how easy it is. Now I tried to switch to UI Kit 2 to use its additional features.
But that was not so simple as I thought (and I thought I would just need to import different libraries).

I have read the documentation and also a lot of documentation about Custom UI (although I try to avoid to switcht to Custom UI for now). But still have trouble understanding:

  1. Why do I have to split the code into the frontend part and backend part (with resolver functions, Custom UI bridge, etc.)? Neither React nor UI Kit work like that (as far as I know)

  2. Since (in UI Kit) I have all my code in one place, how do I decide, which code to put into the frontend and which to backend? My current understanding is that most of it will stay in frontend, but not all.

My app is Jira app, it is fetching information from Jira and also from external APIs, and it is using Storage API for project settings.
In future I would also like to switch to Native Node.js runtime.

Thanks,
Daniel

Hi Daniel,

Thanks for reaching out.

The difference between UI Kit 1 and UI Kit 2 is ultimately where the application logic runs. In UI Kit 1 all the application logic runs in a server side lambda, whereas in UI Kit 2 the rendering logic runs in an isolated runtime on the client (i.e the browser).

In this regards it is very similar to Custom UI (in fact it uses a lot of the same underlying infrastructure) and like Custom UI it is necessary to use a resolver to access certain capabilities (like application storage).

The resolver also runs in a lambda, which is why UI Kit 1 can run entirely in the lambda, but this is why it is necessary to split code. How you handle this split really depends on what the application does so there is no simple answer.

I’ve written a few Forge applications now and in my experience I would say that the only thing I’ve had to use the resolver for is accessing storage, but of course depending on your application your scenario may change.

If you’re accessing data from Jira then you will be able to do most things in the frontend code using the requestJira bridge (see https://developer.atlassian.com/platform/forge/custom-ui-bridge/requestJira/ which is shared by both UI Kit 2 and Custom UI)

This section describes when you’ll need to use a resolver: https://developer.atlassian.com/platform/forge/ui-kit-2/api-requests/#non-product-fetch-requests-and-the-storage-api

I hope this helps,

Regards,
Dave

3 Likes

Thanks, I’m slowly grasping the concept.
Complicated resolve.define and invoke syntax is causing me trouble. I am not an experineced JS dev.