diff --git a/lib/hooks/useErmForm.js b/lib/hooks/useErmForm.js
index e5e7ef98..89fb1f1f 100644
--- a/lib/hooks/useErmForm.js
+++ b/lib/hooks/useErmForm.js
@@ -23,11 +23,13 @@ const useErmForm = ({ navigationCheck = true } = {}) => {
if (navigationCheck) {
// Is this whole history.unblock a stale function? Maybe have the whole thing in state or ref?
const unblock = history.block((nextLoc) => {
- // Due to stale closure probolems, grab current state from "state updator" pattern
- console.log("FORMSPYREF (FIRST): %o", formSpyRef);
+ // console.log('FORMSPYREF (FIRST): %o', formSpyRef);
+ console.log('FORMSPYREF (dirty):', formSpyRef.current.dirty);
+ console.log('FORMSPYREF (submitSucceeded):', formSpyRef.current.submitSucceeded);
+ console.log('FORMSPYREF (submitting):', formSpyRef.current.submitting);
const shouldPrompt = !!formSpyRef.current && formSpyRef.current.dirty && !formSpyRef.current.submitSucceeded && !formSpyRef.current.submitting;
- console.log("FORMSPYREF: %o", formSpyRef);
- console.log("shouldPrompt: %o", shouldPrompt);
+ console.log('FORMSPYREF: %o', formSpyRef);
+ console.log('shouldPrompt: %o', shouldPrompt);
if (shouldPrompt) {
setOpenModal(true);
@@ -80,6 +82,9 @@ const useErmForm = ({ navigationCheck = true } = {}) => {
{
+ console.log('FormSpy - submitting:', state.submitting);
+ console.log('FormSpy - submitSucceeded:', state.submitSucceeded);
+ console.log('FormSpy - dirty:', state.dirty);
formSpyRef.current = state;
}}
subscription={{