mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Fix template and prototype bugs
This commit is contained in:
@@ -211,6 +211,10 @@ const Project = () => {
|
||||
});
|
||||
} else getProjects();
|
||||
|
||||
return () => {
|
||||
setProject(undefined);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
}, [id, role]);
|
||||
|
||||
@@ -236,6 +240,11 @@ const Project = () => {
|
||||
}
|
||||
})();
|
||||
|
||||
return () => {
|
||||
setPrototype(undefined);
|
||||
setTransactionsData(undefined);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
}, [project]);
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ const Template = () => {
|
||||
GetAllTemplatesQueryVariables
|
||||
>(GET_ALL_TEMPLATES, {
|
||||
onCompleted({ getAllTemplates }) {
|
||||
setTemplate(getAllTemplates[0]);
|
||||
getCategory({ variables: { id: template?.category! } });
|
||||
if (getAllTemplates.length > 0)
|
||||
history.push(`/template/${getAllTemplates[0].id}`);
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
@@ -82,8 +82,9 @@ const Template = () => {
|
||||
GetPrototypeByIdQueryVariables
|
||||
>(GET_PROTOTYPE_BY_ID, {
|
||||
onCompleted({ getPrototypeById }) {
|
||||
setPrototype(getPrototypeById.prototype);
|
||||
if (getPrototypeById) setPrototype(getPrototypeById.prototype);
|
||||
},
|
||||
fetchPolicy: 'network-only',
|
||||
});
|
||||
|
||||
const handlePrint = useReactToPrint({
|
||||
@@ -98,6 +99,11 @@ const Template = () => {
|
||||
getTemplates();
|
||||
}
|
||||
|
||||
return () => {
|
||||
setTemplate(undefined);
|
||||
setPrototype(undefined);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
}, [id]);
|
||||
|
||||
@@ -140,7 +146,9 @@ const Template = () => {
|
||||
variant='primary-action'
|
||||
text='Prototype'
|
||||
iconLeft={<Design />}
|
||||
disabled={!prototype && role === 'productOwner'}
|
||||
disabled={
|
||||
prototype === undefined && role === 'productOwner'
|
||||
}
|
||||
onClick={() =>
|
||||
history.push(`/prototype/${id || template.id}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user