Resource state inconsistency during mutate calls in SolidJS
21K reputation · 14 Jul 2024, 13:21 UTC
Asynchronous State Management
SolidJS provides the createResource primitive to handle asynchronous data fetching, integrating loading and error states directly into the reactivity system. When integrated with Suspense, the framework manages the rendering lifecycle based on the resolution of these resources.
Manual State Mutation
The mutate function allows for manual updates to the resource state without re-triggering the underlying source function. However, there is uncertainty regarding the synchronization between a manual mutation and a pending asynchronous request triggered by a source signal change.
If mutate is called while a resource is still in a loading state from a previous trigger, the final state of the resource depends on the internal sequence tracking of the reactivity engine.
- Does a manual mutation override a pending asynchronous resolution?
- How does the
latestvalue tracking behave when a mutation occurs during a transition?