snapshot of https://github.com/mountain-loop/yaak.git (main, 2026-09-23; blobs > 131072B omitted)
This commit is contained in:
18
apps/yaak-client/hooks/useGraphQLSchemaFile.ts
Normal file
18
apps/yaak-client/hooks/useGraphQLSchemaFile.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { useKeyValue } from "./useKeyValue";
|
||||
|
||||
// The file a request's GraphQL schema is loaded from, or null when the schema
|
||||
// comes from an introspection request.
|
||||
//
|
||||
// This is the *source*, not the schema. The introspection row it produces is a
|
||||
// cache that expires on its own; this outlives it and regenerates it, the same
|
||||
// way gRPC keeps its proto file list separate from a reflection result.
|
||||
export function graphqlSchemaFileArgs(requestId: string | null) {
|
||||
return {
|
||||
namespace: "global" as const,
|
||||
key: ["graphql_schema_file", requestId ?? "n/a"],
|
||||
};
|
||||
}
|
||||
|
||||
export function useGraphQLSchemaFile(requestId: string | null) {
|
||||
return useKeyValue<string | null>({ ...graphqlSchemaFileArgs(requestId), fallback: null });
|
||||
}
|
||||
Reference in New Issue
Block a user