Skip to content

Commit 190972f

Browse files
committed
no schema case
1 parent 8441add commit 190972f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/compass-schema/src/components/export-schema-modal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ const ExportSchemaModal: React.FunctionComponent<{
195195
variant="primary"
196196
isLoading={!downloadUrl}
197197
loadingIndicator={<SpinLoader />}
198+
disabled={!exportedSchema}
198199
>
199200
Export
200201
</Button>

packages/compass-schema/src/stores/schema-export-reducer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@ const prepareDownload = (): SchemaThunkAction<void> => {
214214
return (dispatch, getState, { track, connectionInfoRef, namespace }) => {
215215
let stage = 'initial';
216216
const { exportedSchema, exportFormat } = getState().schemaExport;
217+
if (!exportedSchema) return;
217218

218219
try {
219220
stage = 'stringify';
220221
// const stringified = JSON.stringify({ abc: 1 }, null, 2);
221222

222223
stage = 'blob';
223224
// TODO: schema is already stringified. are edge cases handled?
224-
// TODO: no schema case
225-
const blob = new Blob([exportedSchema || ''], {
225+
const blob = new Blob([exportedSchema], {
226226
type: 'application/json',
227227
});
228228
const filename = `schema-${exportFormat}-${namespace}.json`;

0 commit comments

Comments
 (0)