Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove logic about form steps #646

Closed
wbazant opened this issue Dec 15, 2024 · 0 comments · Fixed by #650
Closed

Remove logic about form steps #646

wbazant opened this issue Dec 15, 2024 · 0 comments · Fixed by #650
Assignees
Labels
refactoring Internal changes to code aesthetic or structure

Comments

@wbazant
Copy link
Collaborator

wbazant commented Dec 15, 2024

Unfinished from #415. Nothing uses the steps, but the LocationForm code still tries to be generic.

Part of a bit of a plan:

Note for myself for that second part: we need a way to save form values outside of the form, i.e. pass a callback that saves form values on click of the settings button or the "back" button, outside of formik context. But we can't save on every click (or remake the callback) every time the values change, because dispatch() is too slow to happen so much. I think the solution is to access the reference to values, and in Formik this is done through passing a prop called innerRef:

+const FormikAllSteps = ({ children, renderButtons, ...props }) => {
+  const formRef = useRef()
+  console.log('TODO make a callback that saves this value:', formRef.current?.values)
+  return (
+    <Formik
+      innerRef={formRef}
@wbazant wbazant added the refactoring Internal changes to code aesthetic or structure label Dec 15, 2024
@wbazant wbazant self-assigned this Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Internal changes to code aesthetic or structure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant