Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Extra check to disallow mixed field/form access #4

Open
oskarkook opened this issue Oct 17, 2021 · 1 comment
Open

Extra check to disallow mixed field/form access #4

oskarkook opened this issue Oct 17, 2021 · 1 comment

Comments

@oskarkook
Copy link
Owner

  • Variable in context that stores which identifier was last used to access form (everytime a field is accessed, the context is notified)
  • When field() is called, it checks that the identifier of the field is the same as the last access
@oskarkook
Copy link
Owner Author

Another option is to track the call stack.

  • When useForm() is called, ask context for current identifier and save in local variable. Update identifier in context.
  • When context is notified of a field access and its identifier doesn't match the one in context, a warning/error is returned.
  • When component finishes rendering, set context identifier back to the one in the local variable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant