@marimo-team/islands 0.22.4-dev1 → 0.22.4-dev11
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/{ConnectedDataExplorerComponent-DuD8BVl6.js → ConnectedDataExplorerComponent-mLj6D01z.js} +9 -9
- package/dist/{any-language-editor-BHH_pQ6M.js → any-language-editor-BIGc8RUt.js} +3 -3
- package/dist/assets/__vite-browser-external-C4JkHbyY.js +1 -0
- package/dist/assets/{worker-DUYMdbtA.js → worker-D-EdLKct.js} +2 -2
- package/dist/{chat-ui-Cel1kBfc.js → chat-ui-DfR3sT9K.js} +12 -12
- package/dist/{check-CWUkiHmb.js → check-Cex3x9fD.js} +1 -1
- package/dist/{copy-B7781WJ3.js → copy-BRF7ryOP.js} +1 -1
- package/dist/{dist-D_UjpfOY.js → dist-D56NKWim.js} +12 -11
- package/dist/{error-banner-Cjf0RU9I.js → error-banner-DexD-5js.js} +1 -1
- package/dist/{esm-4wmsH2lp.js → esm-BGo_Mcdt.js} +3 -3
- package/dist/{glide-data-editor-BqnvTmDo.js → glide-data-editor-BmyQCm0U.js} +6 -6
- package/dist/{input-CFY9gApZ.js → input-SSWXiS6n.js} +9 -9
- package/dist/{label-DbZGAoCH.js → label-CIR53v8V.js} +24 -24
- package/dist/main.js +98 -82
- package/dist/{mermaid-B2HDLx2g.js → mermaid-B93TKi2g.js} +4 -4
- package/dist/{process-output-DC1TOnIl.js → process-output-BvkX_OeE.js} +2841 -2279
- package/dist/{spec-CD7QaCV-.js → spec-ByDEU1T3.js} +3 -3
- package/dist/style.css +1 -1
- package/dist/{toDate-CUqpEbBS.js → toDate-D1_ZulwM.js} +2 -2
- package/dist/{tooltip-BXEpXV3R.js → tooltip-B5EnNyok.js} +2 -2
- package/dist/{types-D_ntCXg0.js → types-D4-TD_m0.js} +1 -1
- package/dist/{useAsyncData-rN1nzPaS.js → useAsyncData-C9ez7Ilo.js} +1 -1
- package/dist/{useDeepCompareMemoize-Ch-7Rk2x.js → useDeepCompareMemoize-BvvMxigY.js} +2 -2
- package/dist/{useLifecycle-4fA1pHoh.js → useLifecycle-2Vh-WDv6.js} +2 -2
- package/dist/{useTheme-MWfxn4oz.js → useTheme-CxjbgkRc.js} +3 -2
- package/dist/{vega-component-CPhNLfZZ.js → vega-component-Bzzut3-P.js} +7 -7
- package/dist/{zod-C6UGQ3fz.js → zod-D18k8Z52.js} +14 -12
- package/package.json +1 -1
- package/src/components/editor/TracebackModalContainer.tsx +22 -0
- package/src/components/editor/errors/traceback-modal.tsx +87 -0
- package/src/components/editor/output/MarimoErrorOutput.tsx +23 -3
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +16 -2
- package/src/components/ui/toast.tsx +3 -1
- package/src/core/MarimoApp.tsx +2 -0
- package/src/core/cells/__tests__/apply-transaction.test.ts +28 -0
- package/src/core/cells/cells.ts +13 -1
- package/src/core/cells/logs.ts +48 -9
- package/src/core/config/__tests__/config-schema.test.ts +2 -0
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/errors/traceback-atom.ts +9 -0
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +8 -6
- package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +25 -0
- package/dist/assets/__vite-browser-external-WSlCcXn_.js +0 -1
|
@@ -21,17 +21,19 @@ import { BINDING_MANAGER, WIDGET_DEF_REGISTRY } from "./widget-binding";
|
|
|
21
21
|
interface Data {
|
|
22
22
|
jsUrl: string;
|
|
23
23
|
jsHash: string;
|
|
24
|
+
modelId: WidgetModelId;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
type AnyWidgetState = ModelState;
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
* Value payload sent by the frontend on state updates.
|
|
31
|
+
*
|
|
32
|
+
* The initial value from the backend is empty — `model_id` is passed
|
|
33
|
+
* via immutable data attributes (`args`) so it survives value overwrites.
|
|
32
34
|
*/
|
|
33
35
|
interface ModelIdRef {
|
|
34
|
-
model_id
|
|
36
|
+
model_id?: WidgetModelId;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
export function useAnyWidgetModule(opts: { jsUrl: string; jsHash: string }) {
|
|
@@ -117,14 +119,14 @@ export const AnyWidgetPlugin = createPlugin<ModelIdRef>("marimo-anywidget")
|
|
|
117
119
|
z.object({
|
|
118
120
|
jsUrl: z.string(),
|
|
119
121
|
jsHash: z.string(),
|
|
122
|
+
modelId: z.string().transform((v) => v as WidgetModelId),
|
|
120
123
|
}),
|
|
121
124
|
)
|
|
122
125
|
.withFunctions({})
|
|
123
126
|
.renderer((props) => <AnyWidgetSlot {...props} />);
|
|
124
127
|
|
|
125
128
|
const AnyWidgetSlot = (props: IPluginProps<ModelIdRef, Data>) => {
|
|
126
|
-
const { jsUrl, jsHash } = props.data;
|
|
127
|
-
const { model_id: modelId } = props.value;
|
|
129
|
+
const { jsUrl, jsHash, modelId } = props.data;
|
|
128
130
|
const host = props.host as HTMLElementNotDerivedFromRef;
|
|
129
131
|
|
|
130
132
|
const { jsModule, error } = useAnyWidgetModule({ jsUrl, jsHash });
|
|
@@ -29,6 +29,7 @@ describe("LoadedSlot", () => {
|
|
|
29
29
|
data: {
|
|
30
30
|
jsUrl: "http://example.com/widget.js",
|
|
31
31
|
jsHash: "abc123",
|
|
32
|
+
modelId: modelId,
|
|
32
33
|
},
|
|
33
34
|
host: document.createElement(
|
|
34
35
|
"div",
|
|
@@ -67,6 +68,30 @@ describe("LoadedSlot", () => {
|
|
|
67
68
|
});
|
|
68
69
|
});
|
|
69
70
|
|
|
71
|
+
it("should not remount when value update drops model_id", async () => {
|
|
72
|
+
// Regression: when the frontend sends a state update (e.g. {zoom_level: 0}),
|
|
73
|
+
// it overwrites the UIElement value that originally held {model_id: "..."}.
|
|
74
|
+
// The key must stay stable because modelId comes from data, not value.
|
|
75
|
+
const { container, rerender } = render(<LoadedSlot {...mockProps} />);
|
|
76
|
+
|
|
77
|
+
await waitFor(() => {
|
|
78
|
+
expect(mockWidget.render).toHaveBeenCalledTimes(1);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const divBefore = container.querySelector("div");
|
|
82
|
+
|
|
83
|
+
// Simulate a value update that does NOT include model_id
|
|
84
|
+
// (this is what happens when the widget sends trait state)
|
|
85
|
+
rerender(<LoadedSlot {...mockProps} />);
|
|
86
|
+
|
|
87
|
+
await waitFor(() => {
|
|
88
|
+
// The div should be the same DOM node (no remount)
|
|
89
|
+
expect(container.querySelector("div")).toBe(divBefore);
|
|
90
|
+
// render should not be called again (no remount)
|
|
91
|
+
expect(mockWidget.render).toHaveBeenCalledTimes(1);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
70
95
|
it("should re-run widget when widget prop changes", async () => {
|
|
71
96
|
const { rerender } = render(<LoadedSlot {...mockProps} />);
|
|
72
97
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./worker-DUYMdbtA.js";var t=e(((e,t)=>{t.exports={}}));export default t();
|