You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 14, 2018. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 14, 2018. It is now read-only.
The problem is that, React state has getInitialState, so the default state can be defined inside the component. With cursors, the default state has to be declared somewhere else, at the top.
So suppose refine could take an optional extra argument, a fallback value
The thoughtwork for this is done, we have a working clojure implementation. However, we will need to remove the varargs from refine - so the first argument needs to be a list. So this will break api compat and add some verbosity.
I want this for 2.0 but i don't want to break API compat, i may introduce a new API for this e.g. refineWithDefault or refineWith i have to think about the naming
Here's a compromise: we could do type-checking on the varargs - Unless the last arg to refine is a string, consider it a default value for the path given so far?
Of course, this would preclude strings from being default values, but it would preserve API compat.
What other edge cases does this run into?
I'm not super thrilled by the idea, but I'm just throwing it out there for your thoughts.
Activity
dustingetz commentedon Dec 9, 2015
The thoughtwork for this is done, we have a working clojure implementation. However, we will need to remove the varargs from refine - so the first argument needs to be a list. So this will break api compat and add some verbosity.
dustingetz commentedon Jan 16, 2016
I want this for 2.0 but i don't want to break API compat, i may introduce a new API for this e.g.
refineWithDefaultorrefineWithi have to think about the namingdanielmiladinov commentedon Feb 14, 2016
Here's a compromise: we could do type-checking on the varargs - Unless the last arg to refine is a string, consider it a default value for the path given so far?
Of course, this would preclude strings from being default values, but it would preserve API compat.
What other edge cases does this run into?
I'm not super thrilled by the idea, but I'm just throwing it out there for your thoughts.
dustingetz commentedon Feb 14, 2016
String default values are a very common case i think