@malloy-publisher/sdk 0.0.132 → 0.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@malloy-publisher/sdk",
3
3
  "description": "Malloy Publisher SDK",
4
- "version": "0.0.132",
4
+ "version": "0.0.134",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",
7
7
  "module": "dist/index.es.js",
@@ -9,6 +9,7 @@ import {
9
9
  import React, { useEffect, useState } from "react";
10
10
  import { useMutationWithApiError } from "../../hooks/useQueryWithApiError";
11
11
  import { parseResourceUri } from "../../utils/formatting";
12
+ import { ApiErrorDisplay } from "../ApiErrorDisplay";
12
13
  import { useServer } from "../ServerProvider";
13
14
 
14
15
  type ExplorerComponents = typeof import("@malloydata/malloy-explorer");
@@ -163,7 +164,10 @@ function SourceExplorerComponentInner({
163
164
  executionState: "running",
164
165
  query: query?.malloyQuery,
165
166
  queryResolutionStartMillis: Date.now(),
166
- onCancel: mutation.reset,
167
+ onCancel: () => {
168
+ mutation.reset();
169
+ setSubmittedQuery(undefined);
170
+ },
167
171
  response: {
168
172
  result: {} as Malloy.Result, // placeholder
169
173
  },
@@ -206,6 +210,10 @@ function SourceExplorerComponentInner({
206
210
  );
207
211
  }
208
212
  },
213
+ onError: (error) => {
214
+ setSubmittedQuery(undefined);
215
+ console.error("Query execution error:", error);
216
+ },
209
217
  });
210
218
 
211
219
  const [oldSourceInfo, setOldSourceInfo] = React.useState(
@@ -288,15 +296,24 @@ function SourceExplorerComponentInner({
288
296
  }}
289
297
  />
290
298
  </ResizableCollapsiblePanel>
291
- <ResultPanel
292
- source={sourceAndPath.sourceInfo}
293
- draftQuery={query?.malloyQuery}
294
- setDraftQuery={(malloyQuery) =>
295
- setQuery({ ...query, malloyQuery: malloyQuery })
296
- }
297
- submittedQuery={submittedQuery}
298
- options={{ showRawQuery: true }}
299
- />
299
+ {mutation.isError && mutation.error ? (
300
+ <Box sx={{ p: 2 }}>
301
+ <ApiErrorDisplay
302
+ error={mutation.error}
303
+ context={`Query execution error`}
304
+ />
305
+ </Box>
306
+ ) : (
307
+ <ResultPanel
308
+ source={sourceAndPath.sourceInfo}
309
+ draftQuery={query?.malloyQuery}
310
+ setDraftQuery={(malloyQuery) =>
311
+ setQuery({ ...query, malloyQuery: malloyQuery })
312
+ }
313
+ submittedQuery={submittedQuery}
314
+ options={{ showRawQuery: true }}
315
+ />
316
+ )}
300
317
  </div>
301
318
  </MalloyExplorerProvider>
302
319
  </StyledExplorerContent>