Closed elite174 closed 1 month ago
Latest commit: 6531a764403c1048be9f709a790551106f4c0cd5
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Yeah.. I was hoping to avoid this until we had a better idea of what the future API would look like. But it seems we're here. Having something like .latest
is relatively low risk as you said as it isn't transitive and it doesn't cause poor patterns like .state
or .error
or .loading
can unintentionally. So my gut is we can move with this and the migration cost will be relatively minor. It will still be something, but it is localized mostly.
Could someone merge this thing then?
@ryansolid Could someone merge this PR please, if you agree?
I'm not ignoring this. I am just being a little slow. We need to be careful and I'm actively looking at stuff right now that I figured a few more days wouldn't make a huge difference. If I don't get to where I want by the end of the week we can go ahead.
I write about my thinking here: https://dev.to/this-is-learning/async-derivations-in-reactivity-ec5
This PR adds support for
latest
field forcreateAsync
andcreateAsyncStore
for compatibility withcreateResource
.MOTIVATION
At the moment
createAsync
andcreateAsyncStore
are just wrappers forcreateResource
.createResource
provides the mechanism to avoid triggeringSuspense
, which is quite useful in some cases.In order to improve adoption of
createAsync
andcreateAsyncStore
it would be useful to provide this mechanism also for these primitives.In the future major release of solid support of the
latest
field (andcreateResource
) will be dropped in favor ofcreateAsync
andcreateAsyncStore
..latest
could be replaced withlatest(...)
helper (TBD) or could be dropped at all. In both cases the migration will be simple:latest(...)
helper:data.latest
=>latest(data)
.latest
field:data.latest
=>data
At the moment lack of
.latest
support forcreateAsync
andcreateAsyncStore
prevents people from wide adoption of these primitives. Moreover, people start invent some hacks like this which consume much more memory.