createResource signal isn't trigger if undefined or null
Sometimes I want resource to return undefined, when the underlying signal goes undefined. That's how I like it. Why is this forbidden?.. If I change undefined with
true
it triggers as I expect it. but undefined makes more sense here.2 Replies
that's just how
createResource
works, i think it's done so that you can return non-nullable values from fetcher
and have them end up in the resource function, as opposed to just using a booleanAlso in the docs https://docs.solidjs.com/reference/basic-reactivity/create-resource
fetchData will be called as soon as source has any value other than false, null, or undefined.Feels like it could be better surfaced if also described not as part of a snippet