mirror of
https://github.com/graphql-hive/console
synced 2026-05-23 09:08:34 +00:00
Fix createServicesFetcher handle null service url (#563)
This commit is contained in:
parent
c47df8338a
commit
d58a470916
2 changed files with 16 additions and 3 deletions
5
.changeset/famous-readers-cheat.md
Normal file
5
.changeset/famous-readers-cheat.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@graphql-hive/client': minor
|
||||
---
|
||||
|
||||
Fix createServicesFetcher handling null service url
|
||||
|
|
@ -4,7 +4,7 @@ import type { SchemaFetcherOptions, ServicesFetcherOptions } from './internal/ty
|
|||
|
||||
interface Schema {
|
||||
sdl: string;
|
||||
url: string;
|
||||
url: string | null;
|
||||
name: string;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,11 @@ export function createSchemaFetcher({ endpoint, key }: SchemaFetcherOptions) {
|
|||
|
||||
return function schemaFetcher() {
|
||||
return fetcher().then(schema => ({
|
||||
id: createHash('sha256').update(schema.sdl).update(schema.url).update(schema.name).digest('base64'),
|
||||
id: createHash('sha256')
|
||||
.update(schema.sdl)
|
||||
.update(schema.url || '')
|
||||
.update(schema.name)
|
||||
.digest('base64'),
|
||||
...schema,
|
||||
}));
|
||||
};
|
||||
|
|
@ -74,7 +78,11 @@ export function createServicesFetcher({ endpoint, key }: ServicesFetcherOptions)
|
|||
return function schemaFetcher() {
|
||||
return fetcher().then(services =>
|
||||
services.map(service => ({
|
||||
id: createHash('sha256').update(service.sdl).update(service.url).update(service.name).digest('base64'),
|
||||
id: createHash('sha256')
|
||||
.update(service.sdl)
|
||||
.update(service.url || '')
|
||||
.update(service.name)
|
||||
.digest('base64'),
|
||||
...service,
|
||||
}))
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue