Plugin blocking Jira UI - can it load async?

Hey team,

During testing of a Jira plugin I’m developing I noticed that if the API requests my plugin makes (to a 3rd party system) are slow to return data, the entire Jira Issues view is blocked and is waiting for the plugin to render. I always assumed the plugin is loading asynchronously in the view, but looks like I guessed wrong.

To give you and idea what’s going on, my plugin extends the AbstractJiraContextProvider class and in the override of getContextMap I am calling some of my product APIs. For example:

String myTaskId = apiHelper.getProductTaskId(currentIssue);

where getProductTaskId is pretty much doing:

 public JSONObject executeApiRequest(String url, PluginSettingsFactory pluginSettingsFactory) {
        try {
            URL obj = new URL(url);
            HttpURLConnection con = (HttpURLConnection) obj.openConnection();

            String accountId = getAccountId(pluginSettingsFactory);
            con.setRequestProperty("User-Agent", "JiraPlugin");
            con.setRequestProperty("Authorization", getToken(pluginSettingsFactory));
          
            int responseCode = con.getResponseCode();

            if (responseCode < 200 || responseCode >= 300) {
                return null;
            }

            try (InputStream inputStream = con.getInputStream()) {
                BufferedReader in = new BufferedReader(new InputStreamReader(inputStream));
                String jsonText = readAll(in);
                return new JSONObject(jsonText);
            }
        } catch (Exception e) {
        }

        return null;
    }

Has anyone noticed similar behavior when implementing API calls to populate objects in contextMap? Any idea why the plugin is not loading async and what can I do to make it async?

TIA,
Boyan