From 400531b1b744b937c021d64da25d7b6c686d0523 Mon Sep 17 00:00:00 2001 From: Claudia Malzer Date: Mon, 11 Mar 2024 13:11:14 +0100 Subject: [PATCH] add console log statements --- lib/hooks/useErmForm.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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={{