@trops/dash-core 0.1.398 → 0.1.399
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/dist/index.esm.js +31 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24239,6 +24239,35 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24239
24239
|
children = _ref$children === void 0 ? null : _ref$children;
|
|
24240
24240
|
var _useContext = React.useContext(DashboardContext),
|
|
24241
24241
|
dashApi = _useContext.dashApi;
|
|
24242
|
+
|
|
24243
|
+
// When a widget package is updated via Settings > Widgets (or the AI
|
|
24244
|
+
// Widget Builder), the main process broadcasts "widget:installed"
|
|
24245
|
+
// and Dash.js rebroadcasts a "dash:widget-installed" CustomEvent on
|
|
24246
|
+
// window. We listen here, per-instance, and bump a local version
|
|
24247
|
+
// counter when OUR component is the one that was updated. The counter
|
|
24248
|
+
// is embedded in the child's React key so only matching instances
|
|
24249
|
+
// re-mount — unrelated widgets, the sidebar, and the Settings modal
|
|
24250
|
+
// are untouched. Replaces the old global stageKey remount in Dash.js.
|
|
24251
|
+
var _useState = React.useState(0),
|
|
24252
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24253
|
+
componentVersion = _useState2[0],
|
|
24254
|
+
setComponentVersion = _useState2[1];
|
|
24255
|
+
React.useEffect(function () {
|
|
24256
|
+
var onWidgetInstalled = function onWidgetInstalled(e) {
|
|
24257
|
+
var _e$detail;
|
|
24258
|
+
var installed = e === null || e === void 0 || (_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.widgetName;
|
|
24259
|
+
if (!installed) return;
|
|
24260
|
+
if (installed === component) {
|
|
24261
|
+
setComponentVersion(function (v) {
|
|
24262
|
+
return v + 1;
|
|
24263
|
+
});
|
|
24264
|
+
}
|
|
24265
|
+
};
|
|
24266
|
+
window.addEventListener("dash:widget-installed", onWidgetInstalled);
|
|
24267
|
+
return function () {
|
|
24268
|
+
return window.removeEventListener("dash:widget-installed", onWidgetInstalled);
|
|
24269
|
+
};
|
|
24270
|
+
}, [component]);
|
|
24242
24271
|
try {
|
|
24243
24272
|
var m = ComponentManager.componentMap();
|
|
24244
24273
|
if (component && m) {
|
|
@@ -24325,7 +24354,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24325
24354
|
backgroundColor: bgColor,
|
|
24326
24355
|
widgetConfig: helpers.config(),
|
|
24327
24356
|
widgetEventNames: helpers.events()
|
|
24328
|
-
}), "widget-nokids-".concat(widgetKey)) : /*#__PURE__*/jsxRuntime.jsx(WidgetComponent, _objectSpread$C(_objectSpread$C(_objectSpread$C({
|
|
24357
|
+
}), "widget-nokids-".concat(widgetKey, "-v").concat(componentVersion)) : /*#__PURE__*/jsxRuntime.jsx(WidgetComponent, _objectSpread$C(_objectSpread$C(_objectSpread$C({
|
|
24329
24358
|
listen: function listen(listeners, handlers) {
|
|
24330
24359
|
return helpers.listen(listeners, handlers);
|
|
24331
24360
|
},
|
|
@@ -24338,7 +24367,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24338
24367
|
}, params), userPrefs), {}, {
|
|
24339
24368
|
backgroundColor: bgColor,
|
|
24340
24369
|
children: children
|
|
24341
|
-
}), "widget-kids-".concat(widgetKey));
|
|
24370
|
+
}), "widget-kids-".concat(widgetKey, "-v").concat(componentVersion));
|
|
24342
24371
|
|
|
24343
24372
|
// Wrap widget rendering with WidgetContext + error boundary
|
|
24344
24373
|
return /*#__PURE__*/jsxRuntime.jsx(WidgetContext.Provider, {
|