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();
|
} else getProjects();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setProject(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [id, role]);
|
}, [id, role]);
|
||||||
|
|
||||||
@@ -236,6 +240,11 @@ const Project = () => {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setPrototype(undefined);
|
||||||
|
setTransactionsData(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [project]);
|
}, [project]);
|
||||||
|
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ const Template = () => {
|
|||||||
GetAllTemplatesQueryVariables
|
GetAllTemplatesQueryVariables
|
||||||
>(GET_ALL_TEMPLATES, {
|
>(GET_ALL_TEMPLATES, {
|
||||||
onCompleted({ getAllTemplates }) {
|
onCompleted({ getAllTemplates }) {
|
||||||
setTemplate(getAllTemplates[0]);
|
if (getAllTemplates.length > 0)
|
||||||
getCategory({ variables: { id: template?.category! } });
|
history.push(`/template/${getAllTemplates[0].id}`);
|
||||||
},
|
},
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
});
|
});
|
||||||
@@ -82,8 +82,9 @@ const Template = () => {
|
|||||||
GetPrototypeByIdQueryVariables
|
GetPrototypeByIdQueryVariables
|
||||||
>(GET_PROTOTYPE_BY_ID, {
|
>(GET_PROTOTYPE_BY_ID, {
|
||||||
onCompleted({ getPrototypeById }) {
|
onCompleted({ getPrototypeById }) {
|
||||||
setPrototype(getPrototypeById.prototype);
|
if (getPrototypeById) setPrototype(getPrototypeById.prototype);
|
||||||
},
|
},
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
});
|
});
|
||||||
|
|
||||||
const handlePrint = useReactToPrint({
|
const handlePrint = useReactToPrint({
|
||||||
@@ -98,6 +99,11 @@ const Template = () => {
|
|||||||
getTemplates();
|
getTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
setTemplate(undefined);
|
||||||
|
setPrototype(undefined);
|
||||||
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
@@ -140,7 +146,9 @@ const Template = () => {
|
|||||||
variant='primary-action'
|
variant='primary-action'
|
||||||
text='Prototype'
|
text='Prototype'
|
||||||
iconLeft={<Design />}
|
iconLeft={<Design />}
|
||||||
disabled={!prototype && role === 'productOwner'}
|
disabled={
|
||||||
|
prototype === undefined && role === 'productOwner'
|
||||||
|
}
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
history.push(`/prototype/${id || template.id}`)
|
history.push(`/prototype/${id || template.id}`)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user