@xh/hoist 73.0.0-SNAPSHOT.1741714715638 → 73.0.0-SNAPSHOT.1741790055811

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/CHANGELOG.md CHANGED
@@ -6,6 +6,13 @@
6
6
 
7
7
  * Modify `TabContainerModel` to make more methods `protected`, improving extensibility for advanced
8
8
  use-cases.
9
+ * Enhance exception handling in `FetchService` to capture messages returned as raw strings, or without
10
+ explicit names.
11
+
12
+ ### 🐞 Bug Fixes
13
+
14
+ * Prevent native browser context menu on Dash Canvas surfaces. It can hide the Dash Canvas custom
15
+ context menu when an app's `showBrowserContextMenu` flag is `true`.
9
16
 
10
17
  ## v72.1.0 - 2025-02-13
11
18
 
@@ -7,7 +7,7 @@
7
7
  import {PlainObject, XH} from '@xh/hoist/core';
8
8
  import {FetchOptions} from '@xh/hoist/svc';
9
9
  import {pluralize} from '@xh/hoist/utils/js';
10
- import {isPlainObject} from 'lodash';
10
+ import {isPlainObject, truncate} from 'lodash';
11
11
  import {FetchException, HoistException, TimeoutException, TimeoutExceptionConfig} from './Types';
12
12
 
13
13
  /**
@@ -90,17 +90,16 @@ export class Exception {
90
90
  // Try to "smart" decode as server provided JSON Exception (with a name)
91
91
  try {
92
92
  const cType = headers.get('Content-Type');
93
- if (cType && cType.includes('application/json')) {
94
- const serverDetails = JSON.parse(responseText);
95
- if (serverDetails?.name) {
96
- return this.createFetchException({
97
- ...defaults,
98
- name: serverDetails.name,
99
- message: serverDetails.message,
100
- isRoutine: serverDetails.isRoutine ?? false,
101
- serverDetails
102
- });
103
- }
93
+ if (cType?.includes('application/json')) {
94
+ const obj = safeParseJson(responseText),
95
+ message = obj ? obj.message : truncate(responseText?.trim(), {length: 255});
96
+ return this.createFetchException({
97
+ ...defaults,
98
+ name: obj?.name ?? defaults.name,
99
+ message: message ?? statusText,
100
+ isRoutine: obj?.isRoutine ?? false,
101
+ serverDetails: obj ?? responseText
102
+ });
104
103
  }
105
104
  } catch (ignored) {}
106
105
 
@@ -222,6 +221,14 @@ export class Exception {
222
221
  }
223
222
  }
224
223
 
224
+ function safeParseJson(txt: string): PlainObject {
225
+ try {
226
+ return JSON.parse(txt);
227
+ } catch (ignored) {
228
+ return null;
229
+ }
230
+ }
231
+
225
232
  export function isHoistException(src: unknown): src is HoistException {
226
233
  return src?.['isHoistException'];
227
234
  }
@@ -18,7 +18,7 @@ import {
18
18
  import {dashCanvasAddViewButton} from '@xh/hoist/desktop/cmp/button/DashCanvasAddViewButton';
19
19
  import '@xh/hoist/desktop/register';
20
20
  import {Classes, overlay} from '@xh/hoist/kit/blueprint';
21
- import {TEST_ID} from '@xh/hoist/utils/js';
21
+ import {consumeEvent, TEST_ID} from '@xh/hoist/utils/js';
22
22
  import classNames from 'classnames';
23
23
  import ReactGridLayout, {WidthProvider} from 'react-grid-layout';
24
24
  import {DashCanvasModel} from './DashCanvasModel';
@@ -125,6 +125,7 @@ const onContextMenu = (e, model) => {
125
125
  x = clientX + model.ref.current.scrollLeft,
126
126
  y = clientY + model.ref.current.scrollTop;
127
127
 
128
+ consumeEvent(e);
128
129
  showContextMenu(
129
130
  dashCanvasContextMenu({
130
131
  dashCanvasModel: model,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "73.0.0-SNAPSHOT.1741714715638",
3
+ "version": "73.0.0-SNAPSHOT.1741790055811",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",