AP.navigator.getLocation and query param page.id might point to wrong contentId

Dear community,

I just found out that AP.navigator.getLocation and the query param page.id might refer to the page visited before (not the current one) under the following conditions:

  • The current page is the home page of a space
  • The user used the breadcrumbs links to navigate to the space’s home page from another page in the space

Steps to reproduce:

  • Create a space with a home page and at least one child page
  • Ensure that you can use AP.navigator.getLocation on the space’s home page (alternative: have e.g. a webItem which consumes page.id)
  • Reload the space’s homepage and execute AP.navigator.getLocation - it returns the correct contentId
  • Navigate to a child page in the space
  • Navigate back to the space’s homepage using the breadcrumb links above the page’s title.
  • Execute AP.navigator.getLocation - its shows the contentId of the page visited before

Does anyone had similar issues?

Thank you

Andreas

1 Like

I hadn’t noticed that exact problem, but had noticed an issue with custom overview (home) pages in spaces - it reports the default page, not the details of the app (it returns a different object for general pages). BTW page.id is deprecated.

I have been able to replicate the issue.

The href field reported by getLocation reports the correct page, but the contentId is wrong (the previous page):
image
homepageId is the correct id, the contentId shown is the previous id.

In the interim, you could compare the href and reported contentId?

However, I have a webitem in the content tools menu and the query string reflects the correct info (including content.id/page.id).

1 Like

Dear @james.dellow

many thanks for looking into that.

You are right, the URL has the homepageId which I could use. However the content.id (thanks for pointing out the deprecation of page.id) is not correct for our webItem which points to a dialog.

 "dialogs": [{
		        "url": "/dialog?contentId={content.id}&spaceKey={space.key}",
		        "key": "some-key",
...
"webItems": [
        	{
                "location": "system.content.button",
                "context": "addon",
                "weight": 200,
                "target": {
                    "type": "dialogmodule",
                   	"options": {
      					"key": "some-key"
   					}
                },

The only thing I can is checking in the JS part whether the submitted id was correct comparing it to the homepageId as you suggested.

Thank you

Andreas

1 Like

@andreas1 , @james.dellow Short question: can you point me to documentation about deprecation of page.id and move to content.id?

It is here: Context parameters

page.id et al for dynamic content macros however don’t seem to be deprecated: Dynamic Content Macro

Maybe Atlassian dropped the ball on this one and never finished the job?

Thanks for the replies!

@dmorrow Can you help us clarifying if page.id is indeed deprecated, as stated in Context parameters , or is is not deprecated, as documented in e.g. Dynamic Content Macro ?