Skip to content

Commit

Permalink
add console log statements
Browse files Browse the repository at this point in the history
  • Loading branch information
CalamityC committed Mar 11, 2024
1 parent 6b36b5a commit 400531b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/hooks/useErmForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 27 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 27 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
console.log('FORMSPYREF (submitSucceeded):', formSpyRef.current.submitSucceeded);

Check warning on line 28 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 28 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
console.log('FORMSPYREF (submitting):', formSpyRef.current.submitting);

Check warning on line 29 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 29 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
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);

Check warning on line 31 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 31 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
console.log('shouldPrompt: %o', shouldPrompt);

Check warning on line 32 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 32 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

if (shouldPrompt) {
setOpenModal(true);
Expand Down Expand Up @@ -80,6 +82,9 @@ const useErmForm = ({ navigationCheck = true } = {}) => {
<FormComponent {...formProps} />
<FormSpy
onChange={state => {
console.log('FormSpy - submitting:', state.submitting);

Check warning on line 85 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 85 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
console.log('FormSpy - submitSucceeded:', state.submitSucceeded);

Check warning on line 86 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 86 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
console.log('FormSpy - dirty:', state.dirty);

Check warning on line 87 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement

Check warning on line 87 in lib/hooks/useErmForm.js

View workflow job for this annotation

GitHub Actions / github-actions-ci

Unexpected console statement
formSpyRef.current = state;
}}
subscription={{
Expand Down

0 comments on commit 400531b

Please sign in to comment.