Leveraging Expert Linking Relationships for PR
If userResource is or, companyResource goes into the filling state and its loader does not run. If userResource is in an state, companyResource also gets in the error state.
When userResource is fixed or regional, chain returns its value, which can itself be undefined. The example handles this with chain(userResource)?. companyId, so an undefined worth leads to undefined params and companyResource ends up being idle. Pass the chained worth straight as the params worth rather than wrapping it in a things. A params worth like companyId: undefined is still a specified value, so the loader would run with an undefined companyId instead of the resource ending up being idle.
Using chain is preferred due to the fact that it properly mirrors loading and error states. Reach for chain just when the downstream resource performs its own async work that depends on the upstream worth.

Every resource has a snapshot property that provides a signal of its current state.; const userSnapshot = userResource.snapshot; Each photo contains a status and either a value or an error.