[✨]Loading option for slow network in loader$
Is your feature request related to a problem?
Being able to have the loading option when a loader$ is consumed, in the event that the response is not immediate
Describe the solution you'd like
/** Resulting data from an [operation]{@link Operation}. */
export interface OperationResult<Data = any, Variables extends AnyVariables = AnyVariables> {
/** The [operation]{@link Operation} which has been executed. */
operation: Operation<Data, Variables>;
/** The data returned from the Graphql server. */
data?: Data;
/** Any errors resulting from the operation. */
error?: CombinedError;
/** Optional extensions return by the Graphql server. */
extensions?: Record<string, any>;
/** Optional stale flag added by exchanges that return stale results. */
stale?: boolean;
/** Optional hasNext flag indicating deferred/streamed results are following. */
hasNext?: boolean;
/* OptionaL loading flag indicating whether the operation is still in flight. */
loading?: boolean;
}
Describe alternatives you've considered
This is what you can wear today. But it is not very flexible
<Resource
value={weatherResource}
onPending={() => <div>Loading...</div>}
onRejected={() => <div>Failed to load weather</div>}
onResolved={(weather) => {
return <div>Temperature: {weather.temp}</div>;
}}
/>
Additional context
No response
Out of order rendering is not supported yet. but it's in the todo list
@manucorporat would it be possible to have a routeLoader$ that only loads in the browser, not on the server? It is possible to use a useResource or a server$ function, however, these don't get prefetched on link hovers or refetched when an action$ is submitted.
This would be to support long running queries. I realise now this thread was actually for slow networks, sorry!
@DustinJSilk But also for large queries it is the same case. Because if a slow network is coupled with a large query
Out of order rendering will be in v2