Hello,
I’m having trouble getting the context from view.getContext(), and I’m not sure how to resolve it. I currently have a UI Kit 1 application, which is deprecated, so I plan to switch to a newer version.
const ViewAttachmentLabels = () => {
const [context, setContext] = useState(undefined);
useEffect(() => {
view.getContext().then((c) => setContext(c))
}, [])
console.log("CONTEXT:", context);
const {
extensionContext: { fieldType, fieldId, fieldValue },
moduleKey,
accountId,
cloudId,
platformContext: { issueId, issueTypeId, projectId },
} = context;
const hasLicense = isLicenseActive(context);
if (!hasLicense) {
return (
<CustomField>
<Text>{LICENSE_INVALID}</Text>
</CustomField>
)
}
if (!fieldValue) {
return (<Badge>
<Text>
-
</Text>
</Badge>)
}
return (
<Badge>
<Text>
{fieldType.includes(MULTI) ? fieldValue.join(", ") : fieldValue}
</Text>
</Badge>
)
}
ForgeReconciler.render(
<React.StrictMode>
<ViewAttachmentLabels />
</React.StrictMode>
);