Using Web Workers in Forge effectively to fetch data

Hi,
I wanted to move a big part of data loading into a web worker with custom UI. Sadly, something in the @forge/bridge is using window! And thus I cannot send authenticated requests to my site. This global variable is not defined within web workers’ scope!
Also it is not possible to fetch data from the atlassian site, because the access token is within a closure.
I know this is a security concern.
Nevertheless, I would highly appreciate to build a top state of the art fast UI with web workers and non blocking data loading in Jira Cloud.

5 Likes

Thanks for the suggestion @lkimmel - I have created a suggest Jira issue for this here: [FRGE-1360] - Ecosystem Jira

2 Likes

Could you explain a little bit more about your use case? What’s the advantage of trying to utilise web webworkers instead of using a resolver to trigger async processing on the Forge backend?

The Forge-Backend has a very limiting runtime (25s) and invocation limits. Nevertheless it is simply state of the art, to use web workers in order to load and process some data in advance and cache it in the browser before actually using the app. In this case we want to load certain sets of issues and process them in order to display statistics based on these issues. The issues are filtered by JQL and is based on user’s permissions. The Forge function would definately run into runtime or invocation limits and it’s not bad to run this kind of requests in the browser, because we want to display these issues anyway. Loading these issues even via a Forge function would block the UI thread in the browser.

Thanks for the additional context! :+1:

EDIT: FYI if you run async tasks on the forge runtime the timeout is 55s not 25s (still could be an issue, but depending on use case could make a big difference).