@@ -1,5 +1,5 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { usePreparationDirty } from '@/hooks/use-preparation-dirty';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
@@ -83,22 +83,7 @@ export default function ApprovalTimeouts(props: Props) {
|
||||
},
|
||||
);
|
||||
const current = form.data.version === (props.current?.version ?? 0);
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
const ref = usePreparationDirty(form.isDirty);
|
||||
const edit = () =>
|
||||
form.setData({
|
||||
operation_key: '',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { usePreparationDirty } from '@/hooks/use-preparation-dirty';
|
||||
import {
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -36,22 +36,7 @@ export default function UrgentReviewPolicy(props: {
|
||||
reason: '',
|
||||
},
|
||||
);
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
const ref = usePreparationDirty(form.isDirty);
|
||||
const current = form.data.version === (props.current?.version ?? 0);
|
||||
return (
|
||||
<main className="mx-auto flex w-full max-w-6xl flex-col gap-6 p-5 lg:p-8">
|
||||
|
||||
Reference in New Issue
Block a user