Skip to content

Commit

Permalink
Merge pull request #1537 from redpanda-data/CONSOLE-75-fixes-renderin…
Browse files Browse the repository at this point in the history
…g-error-if-schema-is-requested-but-not-supported

Fixes a rendering error if schemaVersion is requested by not supported
  • Loading branch information
jvorcak authored Nov 29, 2024
2 parents 2f71360 + fb5b6b1 commit 7941b8a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frontend/src/state/backendApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,19 @@ const apiStore = {
},

async refreshSchemaUsagesById(schemaId: number, force?: boolean): Promise<void> {
await cachedApiRequest<SchemaVersion[]>(
type SchemaNotConfiguredType = { isConfigured: false };
function isSchemaVersionArray(r: SchemaVersion[] | SchemaNotConfiguredType): r is SchemaVersion[] {
return Array.isArray(r);
}

await cachedApiRequest<SchemaVersion[] | { isConfigured: false }>(
`${appConfig.restBasePath}/schema-registry/schemas/ids/${schemaId}/versions`,
force,
).then(
(r) => {
this.schemaUsagesById.set(schemaId, r);
if (isSchemaVersionArray(r)) {
this.schemaUsagesById.set(schemaId, r);
}
},
(err) => {
if (err instanceof Error) {
Expand Down

0 comments on commit 7941b8a

Please sign in to comment.