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

update function should accept just new data #165

Open
ayhanyunt12 opened this issue Sep 30, 2022 · 1 comment
Open

update function should accept just new data #165

ayhanyunt12 opened this issue Sep 30, 2022 · 1 comment

Comments

@ayhanyunt12
Copy link

As per the documentation current update method accepts a callback function, we have some cases where we get the latest version of data entirely from the backend and we write logics like
promise(body).then(res => update(() => res))

Maybe changing update method can accept both of them?
update(currentData => ({ ...currentData, username: newUsername, })
update(latestData)

And usage would be more flexible.
promise(body).then(update)

@anacierdem
Copy link

anacierdem commented Sep 30, 2022

It is possible to make it point-free by a few ramda helpers;

.then(converge(update, [always(res)])) // or
.then(chain(update, always(res)))

Not ideal, and I agree, accepting the final data from the original update API is a reasonable request.

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

No branches or pull requests

2 participants