@marimo-team/islands 0.25.3-dev433 → 0.25.3-dev436

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.
@@ -2,7 +2,7 @@ import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
3
  import { t as n } from "./react-dom-DdqGVp5N.js";
4
4
  import { c as r, l as i, u as a } from "./data-grid-types-DIX_pCco.js";
5
- import { a as o, i as s, n as c, r as l } from "./glide-data-editor-CVqz0HKA.js";
5
+ import { a as o, i as s, n as c, r as l } from "./glide-data-editor-D537pcyO.js";
6
6
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/data-grid-overlay-editor-style.js
7
7
  var u = /* @__PURE__ */ e(t(), 1), d = /* @__PURE__ */ e(n(), 1), f = /*#__PURE__*/ o("div")({
8
8
  name: "DataGridOverlayEditorStyle",
@@ -4,13 +4,13 @@ import { t as r } from "./react-Bgs_wQh3.js";
4
4
  import { t as i } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { t as a } from "./copy-icon-Bv5SAA0w.js";
6
6
  import { D as o, E as s, F as c, G as l, N as u, Yt as d, en as f, i as p, n as m } from "./error-entries-BbxtqUQ4.js";
7
- import { n as h, t as ee } from "./globals-eLxNgBb6.js";
7
+ import { n as h, t as ee } from "./globals-DyA5IC15.js";
8
8
  import { r as g } from "./assertNever-ChGm2jYv.js";
9
9
  import { t as _ } from "./jsx-runtime-D8btoEHk.js";
10
10
  import { Lt as v, m as y, xt as te } from "./use-restore-focus-CTa7IRP6.js";
11
11
  import { a as ne, i as re, n as ie, r as ae } from "./dialog-B8vU2hHC.js";
12
12
  import { t as oe } from "./useAsyncData-P5-Oovhq.js";
13
- import { t as se } from "./code-visibility-CI7hiRje.js";
13
+ import { t as se } from "./code-visibility-BMMvUEE0.js";
14
14
  //#region src/components/ui/skeleton.tsx
15
15
  var b = /* @__PURE__ */ e(r(), 1), x = i(), S = _(), ce = (e) => {
16
16
  let n = (0, x.c)(8), r, i;
@@ -14,7 +14,7 @@ import { t as F } from "./jsx-runtime-D8btoEHk.js";
14
14
  import { d as ae, r as I } from "./use-restore-focus-CTa7IRP6.js";
15
15
  import { t as oe } from "./useEvent-BoN7U38T.js";
16
16
  import { n as L, t as se } from "./objectWithoutPropertiesLoose-BRDcTsfB.js";
17
- import { t as ce } from "./ErrorBoundary-5TcguSOl.js";
17
+ import { t as ce } from "./ErrorBoundary-DAkJ7hwU.js";
18
18
  import { A as le, C as ue, D as de, E as fe, F as pe, I as me, L as he, M as ge, N as R, O as z, P as _e, R as ve, S as ye, T as be, _ as xe, a as Se, b as B, c as Ce, d as we, f as V, g as Te, h as Ee, i as De, j as H, k as Oe, l as ke, m as Ae, n as je, o as Me, p as Ne, r as U, s as Pe, t as Fe, u as Ie, v as Le, w as Re, x as ze, y as Be, z as Ve } from "./data-grid-types-DIX_pCco.js";
19
19
  //#region ../node_modules/.pnpm/@emotion+memoize@0.9.0/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
20
20
  function He(e) {
@@ -7061,7 +7061,7 @@ function ds(e, t, n, r, i) {
7061
7061
  }
7062
7062
  //#endregion
7063
7063
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/data-editor/data-editor.js
7064
- var fs = /* @__PURE__ */ e(Tr(), 1), ps = /* @__PURE__ */ e(kr(), 1), ms = W.lazy(async () => await import("./data-grid-overlay-editor-CS3_Bio1.js")), hs = 0;
7064
+ var fs = /* @__PURE__ */ e(Tr(), 1), ps = /* @__PURE__ */ e(kr(), 1), ms = W.lazy(async () => await import("./data-grid-overlay-editor-CkJgQaxE.js")), hs = 0;
7065
7065
  function gs(e) {
7066
7066
  return (0, fs.default)((0, ps.default)((0, ps.default)(e).filter((e) => e.span !== void 0).map((e) => (0, ao.default)((e.span?.[0] ?? 0) + 1, (e.span?.[1] ?? 0) + 1))));
7067
7067
  }
@@ -9284,7 +9284,7 @@ function Ys(e, t, n, r, i) {
9284
9284
  }
9285
9285
  //#endregion
9286
9286
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/cells/number-cell.js
9287
- var Xs = W.lazy(async () => await import("./number-overlay-editor-QZcFeAri.js")), Zs = {
9287
+ var Xs = W.lazy(async () => await import("./number-overlay-editor-BN8eCduk.js")), Zs = {
9288
9288
  getAccessibilityString: (e) => e.data?.toString() ?? "",
9289
9289
  kind: U.Number,
9290
9290
  needsHover: (e) => e.hoverEffect === !0,
@@ -1,6 +1,6 @@
1
1
  import { h as e } from "./tooltip-DsQZP310.js";
2
2
  import { xt as t } from "./use-restore-focus-CTa7IRP6.js";
3
- import { r as n } from "./code-visibility-CI7hiRje.js";
3
+ import { r as n } from "./code-visibility-BMMvUEE0.js";
4
4
  var r = e("triangle-alert", [
5
5
  ["path", {
6
6
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
package/dist/main.js CHANGED
@@ -6,7 +6,7 @@ import { i as x, n as S, r as C, t as w } from "./copy-icon-Bv5SAA0w.js";
6
6
  import { B as T, Bt as E, Ct as D, E as O, F as k, Ft as A, I as j, It as M, L as N, Lt as P, M as F, Mt as I, O as L, Ot as R, P as z, R as B, Rt as ee, St as te, Ut as ne, Vt as re, Wt as ie, X as ae, Z as oe, _ as se, _t as ce, a as le, at as ue, b as de, bt as fe, c as pe, ct as me, dt as he, i as ge, it as _e, j as ve, kt as ye, lt as be, mt as xe, n as Se, o as Ce, ot as we, q as Te, rt as Ee, ut as De, vt as Oe, yt as ke, z as Ae, zt as je } from "./html-to-image-DuNAF8H5.js";
7
7
  import { a as Me, f as Ne, h as Pe, i as Fe, m as Ie, n as Le, o as Re, r as ze, t as Be } from "./tooltip-DsQZP310.js";
8
8
  import { D as Ve, E as He, S as Ue, T as We, _ as Ge, a as Ke, c as qe, d as Je, f as Ye, g as Xe, h as Ze, i as Qe, l as $e, m as et, n as tt, o as nt, p as rt, r as it, s as at, t as ot, u as st, v as ct, w as lt, x as ut, y as dt } from "./spec-BWpscSQi.js";
9
- import { $t as ft, A as pt, At as mt, B as ht, Bt as gt, C as _t, Cn as vt, Ct as yt, D as bt, Dn as xt, Dt as St, E as Ct, En as wt, Et as Tt, F as Et, Ft as Dt, G as Ot, Gt as kt, H as At, Ht as jt, I as Mt, It as Nt, J as Pt, Jt as Ft, K as It, Kt as Lt, L as Rt, Lt as zt, M as Bt, Mt as Vt, N as Ht, Nt as Ut, O as Wt, On as Gt, Ot as Kt, P as qt, Pt as Jt, Qt as Yt, R as Xt, Rt as Zt, S as Qt, Sn as $t, T as en, Tn as tn, Tt as nn, U as rn, Ut as an, V as on, Vt as sn, W as cn, Wt as ln, X as un, Xt as dn, Y as fn, Yt as pn, Z as mn, Zt as hn, _ as gn, _n, _t as vn, an as yn, at as bn, b as xn, bn as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jt as Un, k as Wn, kt as Gn, ln as Kn, lt as qn, m as Jn, mn as Yn, mt as Xn, nn as Zn, nt as Qn, on as $n, ot as er, p as tr, pn as nr, pt as rr, q as ir, qt as ar, r as or, rn as sr, rt as cr, sn as lr, st as ur, t as dr, tn as fr, tt as pr, u as mr, un as hr, ut as gr, v as _r, vn as vr, vt as yr, w as br, wn as xr, wt as Sr, x as Cr, xn as wr, y as Tr, yt as Er, z as Dr, zt as Or } from "./common-DnVhRxZd.js";
9
+ import { $t as ft, A as pt, At as mt, B as ht, Bt as gt, C as _t, Cn as vt, Ct as yt, D as bt, Dn as xt, Dt as St, E as Ct, En as wt, Et as Tt, F as Et, Ft as Dt, G as Ot, Gt as kt, H as At, Ht as jt, I as Mt, It as Nt, J as Pt, Jt as Ft, K as It, Kt as Lt, L as Rt, Lt as zt, M as Bt, Mt as Vt, N as Ht, Nt as Ut, O as Wt, On as Gt, Ot as Kt, P as qt, Pt as Jt, Qt as Yt, R as Xt, Rt as Zt, S as Qt, Sn as $t, T as en, Tn as tn, Tt as nn, U as rn, Ut as an, V as on, Vt as sn, W as cn, Wt as ln, X as un, Xt as dn, Y as fn, Yt as pn, Z as mn, Zt as hn, _ as gn, _n, _t as vn, an as yn, at as bn, b as xn, bn as Sn, bt as Cn, c as wn, cn as Tn, ct as En, d as Dn, dn as On, dt as kn, en as An, f as jn, fn as Mn, ft as Nn, g as Pn, gn as Fn, gt as In, h as Ln, hn as Rn, ht as zn, in as Bn, it as Vn, j as Hn, jt as Un, k as Wn, kt as Gn, ln as Kn, lt as qn, m as Jn, mn as Yn, mt as Xn, nn as Zn, nt as Qn, on as $n, ot as er, p as tr, pn as nr, pt as rr, q as ir, qt as ar, r as or, rn as sr, rt as cr, sn as lr, st as ur, t as dr, tn as fr, tt as pr, u as mr, un as hr, ut as gr, v as _r, vn as vr, vt as yr, w as br, wn as xr, wt as Sr, x as Cr, xn as wr, y as Tr, yt as Er, z as Dr, zt as Or } from "./common-iWYyPuv_.js";
10
10
  import { a as kr, n as Ar, s as jr, t as Mr } from "./useLifecycle-Bw0JtmoB.js";
11
11
  import { t as Nr } from "./check-BHRB6N0I.js";
12
12
  import { A as Pr, C as Fr, D as Ir, M as Lr, O as Rr, a as zr, c as Br, d as Vr, i as Hr, k as Ur, l as Wr, n as Gr, o as Kr, r as qr, s as Jr, t as Yr, w as Xr, x as Zr } from "./select-Brvb-RwP.js";
@@ -16,7 +16,7 @@ import { At as zi, B as Bi, Dt as Vi, E as Hi, Ft as Ui, G as Wi, Ht as Gi, J as
16
16
  import { a as Da, d as Oa, i as ka, n as Aa, o as ja, r as Ma, s as Na, t as Pa, u as Fa } from "./process-output-Cl97_Reh.js";
17
17
  import { t as Ia } from "./pencil-DWRFEz2B.js";
18
18
  import { a as La, c as Ra, d as za, f as Ba, i as Va, l as Ha, r as Ua } from "./glide-utils-BzjESEmr.js";
19
- import { n as Wa, t as Ga } from "./globals-eLxNgBb6.js";
19
+ import { n as Wa, t as Ga } from "./globals-DyA5IC15.js";
20
20
  import { a as Ka, i as qa, n as Ja, r as Ya, s as Xa, t as Za } from "./assertNever-ChGm2jYv.js";
21
21
  import { t as Qa } from "./react-dom-DdqGVp5N.js";
22
22
  import { t as $a } from "./jsx-runtime-D8btoEHk.js";
@@ -40,10 +40,10 @@ import { n as Xs, t as Zs } from "./esm-Bwp_FHP0.js";
40
40
  import { p as Qs } from "./dist-DpYpG8Yc.js";
41
41
  import { t as $s } from "./useAsyncData-P5-Oovhq.js";
42
42
  import { n as ec, r as tc, t as nc } from "./useDeepCompareMemoize-B2RNcTmn.js";
43
- import { t as rc } from "./ErrorBoundary-5TcguSOl.js";
43
+ import { t as rc } from "./ErrorBoundary-DAkJ7hwU.js";
44
44
  import { G as ic, W as ac } from "./vega-loader.browser-Co9gYE8Z.js";
45
45
  import { a as oc, n as sc } from "./loader-Bin_dutt.js";
46
- import { a as cc, c as lc, i as uc, l as dc, o as fc, s as pc, t as mc } from "./code-visibility-CI7hiRje.js";
46
+ import { a as cc, c as lc, i as uc, l as dc, o as fc, s as pc, t as mc } from "./code-visibility-BMMvUEE0.js";
47
47
  import { t as hc } from "./esm-B9n0caHs.js";
48
48
  //#region ../node_modules/.pnpm/iconify-icon@2.3.0/node_modules/iconify-icon/dist/iconify-icon.mjs
49
49
  var gc = Object.freeze({
@@ -12958,7 +12958,7 @@ function pO(e, t) {
12958
12958
  }
12959
12959
  //#endregion
12960
12960
  //#region src/plugins/impl/DataEditorPlugin.tsx
12961
- var mO = J.lazy(() => import("./glide-data-editor-CVqz0HKA.js").then((e) => e.t)), hO = YE("marimo-data-editor", { cssStyles: [vD, yD] }).withData(W({
12961
+ var mO = J.lazy(() => import("./glide-data-editor-D537pcyO.js").then((e) => e.t)), hO = YE("marimo-data-editor", { cssStyles: [vD, yD] }).withData(W({
12962
12962
  initialValue: W({ edits: G(W({
12963
12963
  rowIdx: K(),
12964
12964
  columnId: U(),
@@ -32704,7 +32704,7 @@ function _U(e) {
32704
32704
  }
32705
32705
  //#endregion
32706
32706
  //#region src/components/editor/renderers/slides-layout/slides-layout.tsx
32707
- var vU = J.lazy(() => import("./reveal-component-D7E9Fi0l.js")), yU = (e) => {
32707
+ var vU = J.lazy(() => import("./reveal-component-DEOP4BIj.js")), yU = (e) => {
32708
32708
  let t = (0, X.c)(33), { layout: n, setLayout: r, cells: i, mode: a } = e, o = _o(Rs), s = a === "read" || o, c = _o(la) > 1, [l, u] = (0, J.useState)(null), d;
32709
32709
  t[0] !== i || t[1] !== n ? (d = hz(i, n), t[0] = i, t[1] = n, t[2] = d) : d = t[2];
32710
32710
  let { slideCells: f, skippedIds: p, noOutputIds: m, slideTypes: h, startCellIndex: g } = d, _;
@@ -1,6 +1,6 @@
1
1
  import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
2
  import { t } from "./react-Bgs_wQh3.js";
3
- import { a as n } from "./glide-data-editor-CVqz0HKA.js";
3
+ import { a as n } from "./glide-data-editor-D537pcyO.js";
4
4
  //#region ../node_modules/.pnpm/@glideapps+glide-data-grid@6.0.4-alpha24_lodash@4.17.21_marked@15.0.12_react-dom@19.3.1_57c124ac5a994dbbf13fd11838cf9ba9/node_modules/@glideapps/glide-data-grid/dist/esm/internal/data-grid-overlay-editor/private/number-overlay-editor-style.js
5
5
  var r = /* @__PURE__ */ e(t()), i = /*#__PURE__*/ n("div")({
6
6
  name: "NumberOverlayEditorStyle",
@@ -3,7 +3,7 @@ import { g as t, h as n, i as r, m as i, t as a } from "./button-qQhINE7z.js";
3
3
  import { t as o } from "./react-Bgs_wQh3.js";
4
4
  import { t as s } from "./compiler-runtime-C5KHtL5D.js";
5
5
  import { h as c, t as l } from "./tooltip-DsQZP310.js";
6
- import { $ as u, Q as d, Sn as f, an as p, et as m, i as h, l as g, n as _, on as v, r as y, t as b, u as x, vn as S, yn as C } from "./common-DnVhRxZd.js";
6
+ import { $ as u, Q as d, Sn as f, an as p, et as m, i as h, l as g, n as _, on as v, r as y, t as b, u as x, vn as S, yn as C } from "./common-iWYyPuv_.js";
7
7
  import { M as w } from "./select-Brvb-RwP.js";
8
8
  import { X as T } from "./dropdown-menu-DzhAnAhr.js";
9
9
  import { Nt as E } from "./error-entries-BbxtqUQ4.js";
@@ -11,7 +11,7 @@ import { t as D } from "./jsx-runtime-D8btoEHk.js";
11
11
  import { Bt as O, Lt as k, f as A, i as ee } from "./use-restore-focus-CTa7IRP6.js";
12
12
  import { t as j } from "./useEvent-BoN7U38T.js";
13
13
  import { o as te } from "./static-state-BhCfPRoz.js";
14
- import { n as ne, t as re } from "./code-visibility-CI7hiRje.js";
14
+ import { n as ne, t as re } from "./code-visibility-BMMvUEE0.js";
15
15
  /* empty css */
16
16
  var M = c("sticky-note", [["path", {
17
17
  d: "M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.25.3-dev433",
3
+ "version": "0.25.3-dev436",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -6,6 +6,8 @@ import {
6
6
  ErrorBoundary as ReactErrorBoundary,
7
7
  } from "react-error-boundary";
8
8
  import { store } from "@/core/state/jotai";
9
+ import { WasmInitializationError } from "@/core/wasm/errors";
10
+ import { reloadSafe } from "@/utils/reload-safe";
9
11
  import { Button } from "../../ui/button";
10
12
  import { Dialog, DialogTrigger } from "../../ui/dialog";
11
13
  import { Toaster } from "../../ui/toaster";
@@ -27,6 +29,7 @@ export const ErrorBoundary: React.FC<PropsWithChildren> = (props) => {
27
29
 
28
30
  const FallbackComponent: React.FC<FallbackProps> = (props) => {
29
31
  const [open, setOpen] = useState(false);
32
+ const requiresReload = props.error instanceof WasmInitializationError;
30
33
 
31
34
  return (
32
35
  <div className="flex-1 flex items-center justify-center flex-col space-y-4 max-w-2xl mx-auto px-6 pb-6">
@@ -52,10 +55,11 @@ const FallbackComponent: React.FC<FallbackProps> = (props) => {
52
55
  </Dialog>
53
56
  <Button
54
57
  data-testid="reset-error-boundary-button"
55
- onClick={props.resetErrorBoundary}
58
+ // WASM initialization promises survive React resets, so reload to retry.
59
+ onClick={requiresReload ? reloadSafe : props.resetErrorBoundary}
56
60
  variant="outline"
57
61
  >
58
- Try again
62
+ {requiresReload ? "Reload page" : "Try again"}
59
63
  </Button>
60
64
  </div>
61
65
  </div>
@@ -15,12 +15,15 @@ import type { EnvironmentInfo } from "@/core/network/types";
15
15
  import { filenameAtom } from "@/core/saving/file-state";
16
16
  import { store } from "@/core/state/jotai";
17
17
  import { ConnectionState } from "@/core/session/types";
18
+ import { reloadSafe } from "@/utils/reload-safe";
18
19
  import { ErrorBoundary } from "../ErrorBoundary";
19
20
 
20
21
  vi.mock("@/utils/copy", () => ({
21
22
  copyToClipboard: vi.fn().mockResolvedValue(undefined),
22
23
  }));
23
24
 
25
+ vi.mock("@/utils/reload-safe", () => ({ reloadSafe: vi.fn() }));
26
+
24
27
  const environment: EnvironmentInfo = {
25
28
  marimo: "1.2.3",
26
29
  editable: false,
@@ -281,6 +284,7 @@ describe("ErrorBoundary report dialog", () => {
281
284
 
282
285
  expect(screen.getByText("recovered child")).toBeVisible();
283
286
  expect(screen.queryByText("Something went wrong")).not.toBeInTheDocument();
287
+ expect(reloadSafe).not.toHaveBeenCalled();
284
288
  });
285
289
 
286
290
  it("does not read notebook source when opened with fresh inclusion preferences", async () => {
@@ -13,6 +13,7 @@ import { useAsyncData } from "@/hooks/useAsyncData";
13
13
  import { prettyError } from "@/utils/errors";
14
14
  import { Logger } from "@/utils/Logger";
15
15
  import { PyodideBridge } from "./bridge";
16
+ import { WasmInitializationError } from "./errors";
16
17
  import { isWasm } from "./utils";
17
18
 
18
19
  /**
@@ -51,7 +52,7 @@ const PyodideLoaderInner: React.FC<PropsWithChildren> = ({ children }) => {
51
52
  }, [error, canPaint]);
52
53
 
53
54
  if (error && !canPaint) {
54
- throw error;
55
+ throw new WasmInitializationError(error);
55
56
  }
56
57
 
57
58
  return (
@@ -0,0 +1,100 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import {
4
+ act,
5
+ fireEvent,
6
+ render,
7
+ screen,
8
+ waitFor,
9
+ } from "@testing-library/react";
10
+ import { createStore, type PrimitiveAtom, Provider } from "jotai";
11
+ import { afterEach, beforeEach, expect, it, vi } from "vitest";
12
+ import { ErrorBoundary } from "@/components/editor/boundary/ErrorBoundary";
13
+ import { toast } from "@/components/ui/use-toast";
14
+ import { Deferred } from "@/utils/Deferred";
15
+ import { reloadSafe } from "@/utils/reload-safe";
16
+ import { PyodideBridge } from "../bridge";
17
+ import { PyodideLoader } from "../PyodideLoader";
18
+
19
+ vi.mock("../bridge", () => ({
20
+ PyodideBridge: { INSTANCE: {} },
21
+ }));
22
+ vi.mock("../utils", () => ({ isWasm: () => true }));
23
+ vi.mock("@/utils/reload-safe", () => ({ reloadSafe: vi.fn() }));
24
+ vi.mock("@/components/ui/use-toast", () => ({ toast: vi.fn() }));
25
+ vi.mock("@/core/lifecycle/render-policy", async () => {
26
+ const { atom } = await import("jotai");
27
+ return { canPaintAtom: atom(false) };
28
+ });
29
+
30
+ let store: ReturnType<typeof createStore>;
31
+
32
+ beforeEach(() => {
33
+ store = createStore();
34
+ PyodideBridge.INSTANCE.initialized = new Deferred<void>();
35
+ vi.spyOn(console, "error").mockImplementation(() => undefined);
36
+ });
37
+
38
+ afterEach(() => {
39
+ vi.restoreAllMocks();
40
+ });
41
+
42
+ async function renderNotebook(canPaint = false) {
43
+ const { canPaintAtom } = await vi.importMock<{
44
+ canPaintAtom: PrimitiveAtom<boolean>;
45
+ }>("@/core/lifecycle/render-policy");
46
+ store.set(canPaintAtom, canPaint);
47
+ return render(
48
+ <Provider store={store}>
49
+ <ErrorBoundary>
50
+ <PyodideLoader>Notebook content</PyodideLoader>
51
+ </ErrorBoundary>
52
+ </Provider>,
53
+ );
54
+ }
55
+
56
+ it("reloads after bootstrap failure instead of remounting with the rejected initialization promise", async () => {
57
+ await renderNotebook();
58
+ const initialized = PyodideBridge.INSTANCE.initialized;
59
+ act(() => initialized.reject(new Error("Failed to fetch: HTTP 500")));
60
+
61
+ const reload = await screen.findByRole("button", { name: "Reload page" });
62
+ expect(screen.getByText("Failed to fetch: HTTP 500")).toBeVisible();
63
+ fireEvent.click(reload);
64
+
65
+ expect(reloadSafe).toHaveBeenCalledOnce();
66
+ expect(PyodideBridge.INSTANCE.initialized).toBe(initialized);
67
+ expect(screen.getByText("Something went wrong")).toBeVisible();
68
+ });
69
+
70
+ it("offers reload again if initialization also fails in a fresh page", async () => {
71
+ const firstPage = await renderNotebook();
72
+ act(() => PyodideBridge.INSTANCE.initialized.reject(new Error("HTTP 500")));
73
+ fireEvent.click(await screen.findByRole("button", { name: "Reload page" }));
74
+ firstPage.unmount();
75
+
76
+ store = createStore();
77
+ PyodideBridge.INSTANCE.initialized = new Deferred<void>();
78
+ await renderNotebook();
79
+ act(() => PyodideBridge.INSTANCE.initialized.reject(new Error("HTTP 500")));
80
+ fireEvent.click(await screen.findByRole("button", { name: "Reload page" }));
81
+
82
+ expect(reloadSafe).toHaveBeenCalledTimes(2);
83
+ expect(screen.getByText("HTTP 500")).toBeVisible();
84
+ });
85
+
86
+ it("keeps paintable notebook content visible when bootstrap fails", async () => {
87
+ await renderNotebook(true);
88
+ act(() => PyodideBridge.INSTANCE.initialized.reject(new Error("HTTP 500")));
89
+
90
+ await waitFor(() =>
91
+ expect(toast).toHaveBeenCalledWith({
92
+ title: "Failed to start the notebook runtime",
93
+ description: "HTTP 500",
94
+ variant: "danger",
95
+ }),
96
+ );
97
+ expect(screen.getByText("Notebook content")).toBeVisible();
98
+ expect(screen.queryByText("Something went wrong")).not.toBeInTheDocument();
99
+ expect(reloadSafe).not.toHaveBeenCalled();
100
+ });
@@ -0,0 +1,8 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ export class WasmInitializationError extends Error {
4
+ public constructor(cause: Error) {
5
+ super(cause.message, { cause });
6
+ this.name = "WasmInitializationError";
7
+ }
8
+ }
@@ -1,194 +0,0 @@
1
- import { a as e } from "./rolldown-runtime-BPCzCO3I.js";
2
- import { h as t, t as n } from "./button-qQhINE7z.js";
3
- import { t as r } from "./react-Bgs_wQh3.js";
4
- import { t as i } from "./compiler-runtime-C5KHtL5D.js";
5
- import { a, t as o } from "./copy-icon-Bv5SAA0w.js";
6
- import { i as s } from "./tooltip-DsQZP310.js";
7
- import { t as c } from "./react-dom-DdqGVp5N.js";
8
- import { t as l } from "./jsx-runtime-D8btoEHk.js";
9
- import { Ft as u, l as d, o as f, xt as p } from "./use-restore-focus-CTa7IRP6.js";
10
- import { a as m, i as h, o as g, r as _, s as v, t as y } from "./toast-DOWc3HtU.js";
11
- import { o as b, t as x } from "./dialog-B8vU2hHC.js";
12
- //#region ../node_modules/.pnpm/react-error-boundary@5.0.0_react@19.3.1/node_modules/react-error-boundary/dist/react-error-boundary.esm.js
13
- var S = i(), C = /* @__PURE__ */ e(r()), w = (0, C.createContext)(null), T = {
14
- didCatch: !1,
15
- error: null
16
- }, E = class extends C.Component {
17
- constructor(e) {
18
- super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = T;
19
- }
20
- static getDerivedStateFromError(e) {
21
- return {
22
- didCatch: !0,
23
- error: e
24
- };
25
- }
26
- resetErrorBoundary() {
27
- let { error: e } = this.state;
28
- if (e !== null) {
29
- var t, n, r = [...arguments];
30
- (t = (n = this.props).onReset) == null || t.call(n, {
31
- args: r,
32
- reason: "imperative-api"
33
- }), this.setState(T);
34
- }
35
- }
36
- componentDidCatch(e, t) {
37
- var n, r;
38
- (n = (r = this.props).onError) == null || n.call(r, e, t);
39
- }
40
- componentDidUpdate(e, t) {
41
- let { didCatch: n } = this.state, { resetKeys: r } = this.props;
42
- if (n && t.error !== null && D(e.resetKeys, r)) {
43
- var i, a;
44
- (i = (a = this.props).onReset) == null || i.call(a, {
45
- next: r,
46
- prev: e.resetKeys,
47
- reason: "keys"
48
- }), this.setState(T);
49
- }
50
- }
51
- render() {
52
- let { children: e, fallbackRender: t, FallbackComponent: n, fallback: r } = this.props, { didCatch: i, error: a } = this.state, o = e;
53
- if (i) {
54
- let e = {
55
- error: a,
56
- resetErrorBoundary: this.resetErrorBoundary
57
- };
58
- if (typeof t == "function") o = t(e);
59
- else if (n) o = (0, C.createElement)(n, e);
60
- else if (r !== void 0) o = r;
61
- else throw a;
62
- }
63
- return (0, C.createElement)(w.Provider, { value: {
64
- didCatch: i,
65
- error: a,
66
- resetErrorBoundary: this.resetErrorBoundary
67
- } }, o);
68
- }
69
- };
70
- function D() {
71
- let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
72
- return e.length !== t.length || e.some((e, n) => !Object.is(e, t[n]));
73
- }
74
- //#endregion
75
- //#region src/components/ui/toaster.tsx
76
- var O = /* @__PURE__ */ e(c(), 1), k = l(), A = () => {
77
- let e = (0, S.c)(5), { toasts: t } = a(), n;
78
- e[0] === t ? n = e[1] : (n = t.map(N), e[0] = t, e[1] = n);
79
- let r;
80
- e[2] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ (0, k.jsx)(j, {}), e[2] = r) : r = e[2];
81
- let i;
82
- return e[3] === n ? i = e[4] : (i = /* @__PURE__ */ (0, k.jsxs)(m, { children: [n, r] }), e[3] = n, e[4] = i), i;
83
- }, j = f(({ container: e }) => (0, O.createPortal)(/* @__PURE__ */ (0, k.jsx)(d, { children: /* @__PURE__ */ (0, k.jsx)(v, {}) }), e ?? document.body)), M = (e) => {
84
- let n = (0, S.c)(23), r, i, a, s, c;
85
- n[0] === e ? (r = n[1], i = n[2], a = n[3], s = n[4], c = n[5]) : ({toastTitle: s, toastDescription: a, action: r, variant: c, ...i} = e, n[0] = e, n[1] = r, n[2] = i, n[3] = a, n[4] = s, n[5] = c);
86
- let l = (0, C.useRef)(null), u = !!a && !r && c === "danger", d;
87
- n[6] === s ? d = n[7] : (d = s && /* @__PURE__ */ (0, k.jsx)(g, { children: s }), n[6] = s, n[7] = d);
88
- let f;
89
- n[8] === a ? f = n[9] : (f = a && /* @__PURE__ */ (0, k.jsx)(h, {
90
- ref: l,
91
- children: a
92
- }), n[8] = a, n[9] = f);
93
- let p;
94
- n[10] !== d || n[11] !== f ? (p = /* @__PURE__ */ (0, k.jsxs)("div", {
95
- className: "grid min-w-0 flex-1 gap-1",
96
- children: [d, f]
97
- }), n[10] = d, n[11] = f, n[12] = p) : p = n[12];
98
- let m;
99
- n[13] !== u || n[14] !== a ? (m = u && /* @__PURE__ */ (0, k.jsx)(o, {
100
- tooltip: "Copy error",
101
- ariaLabel: "Copy error",
102
- className: "h-4 w-4",
103
- buttonClassName: t("absolute right-8 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity", "hover:text-foreground focus:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 group-hover:opacity-100", "group-[.destructive]:text-red-300 hover:group-[.destructive]:text-red-500 focus-visible:group-[.destructive]:ring-red-400 focus-visible:group-[.destructive]:ring-offset-red-600"),
104
- value: () => l.current?.innerText ?? (typeof a == "string" ? a : "")
105
- }), n[13] = u, n[14] = a, n[15] = m) : m = n[15];
106
- let v;
107
- n[16] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ (0, k.jsx)(_, {}), n[16] = v) : v = n[16];
108
- let b;
109
- return n[17] !== r || n[18] !== i || n[19] !== p || n[20] !== m || n[21] !== c ? (b = /* @__PURE__ */ (0, k.jsxs)(y, {
110
- variant: c,
111
- ...i,
112
- children: [
113
- p,
114
- r,
115
- m,
116
- v
117
- ]
118
- }), n[17] = r, n[18] = i, n[19] = p, n[20] = m, n[21] = c, n[22] = b) : b = n[22], b;
119
- };
120
- function N(e) {
121
- let { id: t, title: n, description: r, action: i, variant: a, ...o } = e;
122
- return /* @__PURE__ */ (0, k.jsx)(M, {
123
- toastTitle: n,
124
- toastDescription: r,
125
- action: i,
126
- variant: a,
127
- ...o
128
- }, t);
129
- }
130
- //#endregion
131
- //#region src/components/editor/boundary/ErrorBoundary.tsx
132
- var P = (0, C.lazy)(() => import("./feedback-button-D1iYrW4t.js").then((e) => ({ default: e.FeedbackModal }))), F = (e) => {
133
- let t = (0, S.c)(2), n;
134
- return t[0] === e.children ? n = t[1] : (n = /* @__PURE__ */ (0, k.jsx)(E, {
135
- FallbackComponent: I,
136
- children: e.children
137
- }), t[0] = e.children, t[1] = n), n;
138
- }, I = (e) => {
139
- let t = (0, S.c)(17), [r, i] = (0, C.useState)(!1), a;
140
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ (0, k.jsx)("h1", {
141
- className: "text-2xl font-bold",
142
- children: "Something went wrong"
143
- }), t[0] = a) : a = t[0];
144
- let o = e.error?.message, c;
145
- t[1] === o ? c = t[2] : (c = /* @__PURE__ */ (0, k.jsx)("pre", {
146
- className: "text-xs bg-muted/40 border rounded-md p-4 max-w-[80%] whitespace-normal",
147
- children: o
148
- }), t[1] = o, t[2] = c);
149
- let l;
150
- t[3] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ (0, k.jsx)(b, {
151
- asChild: !0,
152
- children: /* @__PURE__ */ (0, k.jsx)(n, {
153
- variant: "outline",
154
- children: "Report an issue"
155
- })
156
- }), t[3] = l) : l = t[3];
157
- let d;
158
- t[4] === r ? d = t[5] : (d = r && /* @__PURE__ */ (0, k.jsx)(u, {
159
- store: p,
160
- children: /* @__PURE__ */ (0, k.jsxs)(s, { children: [/* @__PURE__ */ (0, k.jsx)(C.Suspense, {
161
- fallback: null,
162
- children: /* @__PURE__ */ (0, k.jsx)(P, {})
163
- }), /* @__PURE__ */ (0, k.jsx)(A, {})] })
164
- }), t[4] = r, t[5] = d);
165
- let f;
166
- t[6] !== r || t[7] !== d ? (f = /* @__PURE__ */ (0, k.jsxs)(x, {
167
- open: r,
168
- onOpenChange: i,
169
- children: [l, d]
170
- }), t[6] = r, t[7] = d, t[8] = f) : f = t[8];
171
- let m;
172
- t[9] === e.resetErrorBoundary ? m = t[10] : (m = /* @__PURE__ */ (0, k.jsx)(n, {
173
- "data-testid": "reset-error-boundary-button",
174
- onClick: e.resetErrorBoundary,
175
- variant: "outline",
176
- children: "Try again"
177
- }), t[9] = e.resetErrorBoundary, t[10] = m);
178
- let h;
179
- t[11] !== f || t[12] !== m ? (h = /* @__PURE__ */ (0, k.jsxs)("div", {
180
- className: "flex flex-wrap items-center justify-center gap-2",
181
- children: [f, m]
182
- }), t[11] = f, t[12] = m, t[13] = h) : h = t[13];
183
- let g;
184
- return t[14] !== c || t[15] !== h ? (g = /* @__PURE__ */ (0, k.jsxs)("div", {
185
- className: "flex-1 flex items-center justify-center flex-col space-y-4 max-w-2xl mx-auto px-6 pb-6",
186
- children: [
187
- a,
188
- c,
189
- h
190
- ]
191
- }), t[14] = c, t[15] = h, t[16] = g) : g = t[16], g;
192
- };
193
- //#endregion
194
- export { F as t };