Understanding action return values
My understanding is that actions that don't return any value are automatically cleared. When I look at the code, it seems that when an action returns a falsey value, it should also be automatically cleared. However, I don't see this happening in practice. Consider the following code:
When the action returns
undefined
or null
, the error is not cleared when the count is incremented, which is expected. However, if it returns 0
or another falsey value, the behavior is different. Am I missing something?GitHub
solid-router/src/data/action.ts at 30f08665e87829736a9333d55863d279...
A universal router for Solid inspired by Ember and React Router - solidjs/solid-router
2 Replies
@core-team anyone able to answer this? he’s updating the docs
Hmm.. I wonder if it is getting serialized in a weird way. No.. this is pure client side example. Returning null/undefined should clear it when it completes. It only keeps things around when they return a value.
To be fair there may be a bug here. I think that code probably should be (result != null). Falsey values like false and definitely 0 probably should stick around. But undefined/null definitely should be gone.