Troubleshooting unsaved changes indicator BOD-172

This commit is contained in:
Patrick Fic
2020-06-25 14:30:57 -07:00
parent 7305994a05
commit 288e5e4c02
2 changed files with 43 additions and 21 deletions

View File

@@ -6,14 +6,17 @@ import { Prompt, useLocation } from "react-router-dom";
export default function FormsFieldChanged({ form }) {
const { t } = useTranslation();
const handleReset = () => {
form.resetFields();
};
const loc = useLocation();
return (
<Form.Item shouldUpdate style={{ margin: 0, padding: 0 }}>
{() => {
console.log("Render", form.isFieldsTouched());
if (form.isFieldsTouched())
return (
<div>
@@ -26,7 +29,7 @@ export default function FormsFieldChanged({ form }) {
}}
/>
<AlertComponent
type='warning'
type="warning"
message={
<div>
<span>{t("general.messages.unsavedchanges")}</span>
@@ -35,7 +38,8 @@ export default function FormsFieldChanged({ form }) {
style={{
cursor: "pointer",
textDecoration: "underline",
}}>
}}
>
{t("general.actions.reset")}
</span>
</div>