Hi there,
I am currently working on an Issue Panel module for my App.
Since it’s a very simple implementation, I am using the UI-Kit…
Within the Issue Panel a function is called which updates a value in the Issue Panel causing a rerender.
Also within the Issue Panel, a new assignee is assigned for the issue. With Assigning the Issue, the Issue automatically updates. The update makes my Issue Panel crash. The Error Message is not that helpful: “Unexpected error in app An error occurred while trying to load this app.”
It seems, the Issue Update is the cause for the Problem. I wrapped all of my corresponding functions in try/catch blocks, but there are no Error logs in my console.
const SomeIssuePanelComponent = () => {
const [someGroupMembers, setSomeGroupMembers] = useState([]);
const [pickedUser, setPickedUser] = useState(null);
const context = useProductContext();
useEffect(async () => {
setSomeGroupMembers(await getAllPotentialAgents());
setPickedUser(
await getAnIssueProperty(context.platformContext.issueId)
);
}, []);
const anIssuePanelFunction = async (formProps) => {
try {
const issueId = context.platformContext.issueId;
const AppUser = await getAppUser();
let promises = [];
promises.push(
saveAnIssueProperty(formProps.user, issueId)
);
promises.push(
sendNotification(formProps.user, issueId)
);
await Promise.all(promises);
setPickedUser(formProps.user);
await assignIssue(issueId, appUser.accountId);
} catch (error) {
console.log(error);
}
};
return (
<Fragment>
{someGroupMembers.length > 0 && (
<Fragment>
<Form
onSubmit={anIssuePanelFunction}
submitButtonAppearance="primary"
>
<Select
label="Set User and Notify"
name="user"
>
<Fragment>
{someGroupMembers.map((user) => (
<Fragment>
<Option
label={user.displayName}
value={user.accountId}
/>
</Fragment>
))}
</Fragment>
</Select>
</Form>
{pickedUser && (
<Fragment>
<Text>
Current User:
<User accountId={pickedUser} />
</Text>
</Fragment>
)}
</Fragment>
)}
</Fragment>
);
};
Thanks in advance,
Adrian