Strangely when I loop an api response :
.then((data) => {
setRecommendations(
data.map(
(recommendation) =>
new RecommendationIssueCreator(
recommendation,
props.data.projectKey,
props.data.issueTypeId,
props.data.assignee
)
)
);
});
and the RecommendationIssueCreator looks like this :
import ForgeUI, { Form, TextArea } from "@forge/ui";
import api, { route } from "@forge/api";
function RecommendationIssueCreator(
recommendation,
projectKey,
issueTypeId,
assignee
) {
function createIssue(data) {
console.log(data);
}
return (
<Form onSubmit={createIssue} submitButtonText="Create Jira Issue">
<TextArea
label={recommendation.title}
name={"recommendation_" + recommendation.id}
defaultValue={recommendation.description}
/>
</Form>
);
}
export default RecommendationIssueCreator;
I get the error below
ERROR 09:53:41.260 44159e2309ea7ce7 function createIssue(data) {
console.log(data);
} could not be cloned.
TypeError: function createIssue(data) {
console.log(data);
} could not be cloned.
at n.wrapValue (bootstrap.js:1:2984)
at n.wrap (bootstrap.js:1:2344)
at bootstrap.js:1:3109
at Array.map (<anonymous>)
at n.wrapArray (bootstrap.js:1:3097)
at n.wrap (bootstrap.js:1:2414)
at bootstrap.js:1:1642
at Array.map (<anonymous>)
at n.applyIgnored (bootstrap.js:1:1630)
at bootstrap.js:1:9840
I fI remove this: onSubmit={createIssue} from the Form it loads without the error, so what I’m really missing here?