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

V2 - allow for async modifyUp()s #280

Open
dxinteractive opened this issue Jan 29, 2020 · 1 comment
Open

V2 - allow for async modifyUp()s #280

dxinteractive opened this issue Jan 29, 2020 · 1 comment

Comments

@dxinteractive
Copy link
Collaborator

Will be great for async validation. May require #238 because chances are that we wouldn't want to merely delay a result, but also set parcel data upon fetch and error.

@dxinteractive
Copy link
Collaborator Author

dxinteractive commented Feb 18, 2020

This will require the reducer to be much smarter.

  • Do V2 - simplify modify methods #284 first
  • modify methods can return an effect function that passes an update function. This can be called as many times as required, however long after the effect function is called
  • effect needs to only be called once for each modifier parcel, after the reducer has run
    • Might need to dedupe if the same modifier parcel effect is being run at different depths. Best approach would be to debounce the effect function as it's passed in
  • reducer will need to be passed a callback that it calls with the result, like an observable, so that it can push multiple changes out
    • Would need to look up the latest version of the parcel in the registry and probably just dispatch the change request on it
    • Add option to memoize the effect
  • usages of the reducer will need to match that same inversion of control too
    • wouldn't need to do this if subsequent calls go via a dispatch on the parcel
  • firing off the effect can be done by taking the action stack at the point where the effect is, cutting off the leaf-ward actions and firing an update action instead.

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

No branches or pull requests

1 participant