I just wonder, is there a way that I could have access to information that useProductContext is providing in my CUSTOM UI ?
I cannot use UI KIT hooks directly into my CUSTOM UI app, but I need so have some context information about my app.
is there a conveniente way to provide such a information in a CUSTOM UI app?
Worth noting that Forge also just gained a dedicated function as of today’s release 2021-05-04:
Custom UI now supports context on the frontend through the new getContext function that’s present on the existing view object. See the view documentation for more details.
The getContext method enables you to retrieve contextual information for your custom UI app. The data available depends on the module in which your app is used. […]
Thank you @MichalMichalczuk and @sopel for your help!
not directly related to this topic but, is there a way to have access on context or I don’t know, pass any value to my manifest.yaml file?
I want to dynamically change my app title based on the project that it’s on ( project name )
AFAIK this is not possible.
In what extension you’d like to do this, and what case do you have?
You can render your own page header in jira:adminPage and jira:projectPage when you set layout: basic in module config (I am not sure about Confluence extension points).
Hi guys,
I’m trying to implement the new function, but I get an empty object.
I tried both backend and frontend, same results. I just need to get the page Id the macro is in.
Any suggestion?
Hi @MichalMichalczuk ,
I tried the new function view.getContext(), but if implemented as above I get a an error related to the use of “await” outside an async function. I’m new to Forge and coding in general as you can see.
I have bridge 1.4.0, cli 1.3.2.
Thanks
@MatteoGubelliniSoftC , You can’t call await outside a async function that’s duo to javascript on browser, top-level await call is not supported by default.
You can try it like this:
async function getContext() {
const context = await view.getContext()
// set context to state or do other logics here
}
useEffect(() => {
getContext()
},[ ])