Routing between sub-pages in Project Settings Page module

Hi everyone,

We’re in the middle of migrating our app from Connect-on-Forge to Forge, and I ran into an issue with the Project Settings Page module. Unlike Connect, Forge doesn’t let you define multiple pages in that module. Because of that, I switched to using sub-pages as described in the docs.

The problem is that navigating between those sub-pages from Jira’s sidebar doesn’t actually do anything but changes the URL. I looked into Custom UI routing through the example in the docs, but that seems to rely on the app’s internal routing (eg. using React Router in combination with view.createHistory API), which makes the Jira sidebar kinda useless.

Is there any way to use the sidebar for navigation here, or is that just not supported?

To anyone having the same problem,

You can use the listen method of the view.createHistory() returned object. It allows the app to track changes in the URL of the browser in modules supporting view.createHistory() API. For example, in my case, I create a state to track the location as the history changes as follow:

          const history = await view.createHistory();
          history.listen((location, action) => {
            setRoute(location.pathname);
          });

This solution is achieved through this post, please visit it and leave a like for the OP!

1 Like