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

Support seamless mutation promise resolution #1

Open
drborges opened this issue Dec 13, 2017 · 0 comments
Open

Support seamless mutation promise resolution #1

drborges opened this issue Dec 13, 2017 · 0 comments
Labels

Comments

@drborges
Copy link
Owner

drborges commented Dec 13, 2017

It would be very convenient if mutations could take promises in addition to sync values, example:

store.users.push(fetch("app.com/users/123"))
store.todos = fetch("app.com/todos?limit=20")

If the mutation value is a Promise, arbor would then only apply the corresponding mutation upon promise resolution.

Failures can still be handled by the caller:

const userPromise = fetch("app.com/users/123").catch(console.log)
store.users.push(userPromise)

This is particularly useful when APIs reflect exactly the data structure expected by the front-end (BFF pattern).

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

No branches or pull requests

1 participant