Git Product home page Git Product logo

proxy-form's Introduction

Jesse Pinkman awkwardly drinking water while looking around

proxy-form's People

Contributors

oskarkook avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

villuv resys-io

proxy-form's Issues

Reducer-like behaviour

It would be good if the library could support or provide examples of using reducers for form updates. This can be useful in some more complicated use-cases.

Validation and errors

Should provide some easy integration for validation and errors. Take a look at react-hook-form for inspiration.

Remove prepare function?

It causes issues with Typescript that are difficult to resolve. A replacement could be to allow the following:

field(prepareMyField(form.myField))

However, this would require that we check correct useForm() usage through call stack tracing. See #4 (comment)

Extra check to disallow mixed field/form access

  • 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

Touched fields?

Similar to changed fields, but instead is registered whenever user interacts (focuses) the field.

Submitting

Either expose an onSubmit() function, or just expose the getForm() function. The latter seems better to me, would also be helpful in some edge cases.

The getForm() function should be renamed to getValues() or something. It would match up with the defaultValues option and would be clear that it's not a proxy that you're receiving.

Translate Immer's patches for arrays?

When a deletion or swap in an array happens, Immer produces the following patches:

  1. If elements are swapped, there is a replace patch
  2. If last element is deleted, the length element is patched
  3. If any element before the last one is deleted, there is additionally a replace patch with the next element as the new value

Possibly, the following patches should be emitted instead:

  1. move operation as described in the JSON patch RFC
  2. remove operation on the last element of the array
  3. remove operation on the given element of the array

Tests

Need to write a large number of tests to ensure correctness.. ๐Ÿ˜…

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.