query
Query
Defined in: src/utils/query/query.ts:15
Minimal representation of a query state. Matches Tanstack Query result.
Properties
| Property | Type | Defined in |
|---|---|---|
isLoading? | boolean | src/utils/query/query.ts:16 |
isError? | boolean | src/utils/query/query.ts:17 |
isSuccess? | boolean | src/utils/query/query.ts:18 |
combineQueries()
function combineQueries(queries): object;
Defined in: src/utils/query/query.ts:38
Combines multiple query states into a single aggregated state.
Parameters
| Parameter | Type |
|---|---|
queries | Query[] |
Returns
object
Combined query state where:
isLoadingis true if any query is loadingisErroris true if any query has an errorisSuccessis true only if all queries are successful
| Name | Type | Defined in |
|---|---|---|
isLoading | boolean | src/utils/query/query.ts:39 |
isError | boolean | src/utils/query/query.ts:40 |
isSuccess | boolean | src/utils/query/query.ts:41 |
Example
const combinedState = combineQueries([
{ isLoading: true },
{ isSuccess: true }
]);
// Result: { isLoading: true, isError: false, isSuccess: false }
parseUnknownError()
function parseUnknownError(error): string;
Defined in: src/utils/query/query.ts:56
Parses an unknown error into a string message. Handles various error formats including Error objects and plain strings.
Parameters
| Parameter | Type |
|---|---|
error | unknown |
Returns
string
Example
parseUnknownError(new Error("Something went wrong")); // "Something went wrong"
parseUnknownError("Custom error message"); // "Custom error message"
parseUnknownError({ message: "Object error" }); // "Object error"
parseUnknownError({}); // "Unknown error happened"