@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.esm.js
CHANGED
|
@@ -24221,6 +24221,35 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24221
24221
|
children = _ref$children === void 0 ? null : _ref$children;
|
|
24222
24222
|
var _useContext = useContext(DashboardContext),
|
|
24223
24223
|
dashApi = _useContext.dashApi;
|
|
24224
|
+
|
|
24225
|
+
// When a widget package is updated via Settings > Widgets (or the AI
|
|
24226
|
+
// Widget Builder), the main process broadcasts "widget:installed"
|
|
24227
|
+
// and Dash.js rebroadcasts a "dash:widget-installed" CustomEvent on
|
|
24228
|
+
// window. We listen here, per-instance, and bump a local version
|
|
24229
|
+
// counter when OUR component is the one that was updated. The counter
|
|
24230
|
+
// is embedded in the child's React key so only matching instances
|
|
24231
|
+
// re-mount — unrelated widgets, the sidebar, and the Settings modal
|
|
24232
|
+
// are untouched. Replaces the old global stageKey remount in Dash.js.
|
|
24233
|
+
var _useState = useState(0),
|
|
24234
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24235
|
+
componentVersion = _useState2[0],
|
|
24236
|
+
setComponentVersion = _useState2[1];
|
|
24237
|
+
useEffect(function () {
|
|
24238
|
+
var onWidgetInstalled = function onWidgetInstalled(e) {
|
|
24239
|
+
var _e$detail;
|
|
24240
|
+
var installed = e === null || e === void 0 || (_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.widgetName;
|
|
24241
|
+
if (!installed) return;
|
|
24242
|
+
if (installed === component) {
|
|
24243
|
+
setComponentVersion(function (v) {
|
|
24244
|
+
return v + 1;
|
|
24245
|
+
});
|
|
24246
|
+
}
|
|
24247
|
+
};
|
|
24248
|
+
window.addEventListener("dash:widget-installed", onWidgetInstalled);
|
|
24249
|
+
return function () {
|
|
24250
|
+
return window.removeEventListener("dash:widget-installed", onWidgetInstalled);
|
|
24251
|
+
};
|
|
24252
|
+
}, [component]);
|
|
24224
24253
|
try {
|
|
24225
24254
|
var m = ComponentManager.componentMap();
|
|
24226
24255
|
if (component && m) {
|
|
@@ -24307,7 +24336,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24307
24336
|
backgroundColor: bgColor,
|
|
24308
24337
|
widgetConfig: helpers.config(),
|
|
24309
24338
|
widgetEventNames: helpers.events()
|
|
24310
|
-
}), "widget-nokids-".concat(widgetKey)) : /*#__PURE__*/jsx(WidgetComponent, _objectSpread$C(_objectSpread$C(_objectSpread$C({
|
|
24339
|
+
}), "widget-nokids-".concat(widgetKey, "-v").concat(componentVersion)) : /*#__PURE__*/jsx(WidgetComponent, _objectSpread$C(_objectSpread$C(_objectSpread$C({
|
|
24311
24340
|
listen: function listen(listeners, handlers) {
|
|
24312
24341
|
return helpers.listen(listeners, handlers);
|
|
24313
24342
|
},
|
|
@@ -24320,7 +24349,7 @@ var WidgetRenderer = function WidgetRenderer(_ref) {
|
|
|
24320
24349
|
}, params), userPrefs), {}, {
|
|
24321
24350
|
backgroundColor: bgColor,
|
|
24322
24351
|
children: children
|
|
24323
|
-
}), "widget-kids-".concat(widgetKey));
|
|
24352
|
+
}), "widget-kids-".concat(widgetKey, "-v").concat(componentVersion));
|
|
24324
24353
|
|
|
24325
24354
|
// Wrap widget rendering with WidgetContext + error boundary
|
|
24326
24355
|
return /*#__PURE__*/jsx(WidgetContext.Provider, {
|