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

Curried functions don't work in store.update #2938

Closed
bionicles opened this issue Jun 2, 2019 · 3 comments
Closed

Curried functions don't work in store.update #2938

bionicles opened this issue Jun 2, 2019 · 3 comments

Comments

@bionicles
Copy link

Hi,

Svelte is cool to write less code. So is Ramda.

Right now, this doesn't work:

import { assoc } from 'ramda';
import { writable } from 'svelte/store'
let store = writable({});
store.update(assoc(123, "four"))

but this does:

store.update(prev => assoc(123, "four", prev))

so does this:
store.update(prev => ({...prev, [newId]: thingToCreate})))

to reduce boilerplate it would be nice to have store update function try apply its argument to previous state

because assoc(id, item) is much less than prev => {...prev, [id]:item}
and that's just the simplest case. we might build partial functions on the fly and apply them to state. If state doesn't accept curried functions from ramda, then we cannot possibly do functional programming in svelte, and developers must hand-code every edge case

@btakita
Copy link
Contributor

btakita commented Jun 3, 2019

@Conduitry
Copy link
Member

This does look to be working. Please reopen with a specific reproduction if you are still seeing problems.

@bionicles
Copy link
Author

@btakita @Conduitry thank you for the proof, for some reason this didn't reflect on my REPL

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

3 participants