@marimo-team/islands 0.22.1-dev20 → 0.22.1-dev22

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/main.js CHANGED
@@ -35867,8 +35867,7 @@ ${E}`,
35867
35867
  ...e
35868
35868
  }));
35869
35869
  var AnyWidgetSlot = (e) => {
35870
- var _a3;
35871
- let r = (0, import_compiler_runtime$90.c)(16), { jsUrl: c, jsHash: d } = e.data, { model_id: f } = e.value, h = e.host, _;
35870
+ let r = (0, import_compiler_runtime$90.c)(14), { jsUrl: c, jsHash: d } = e.data, { model_id: f } = e.value, h = e.host, _;
35872
35871
  r[0] !== d || r[1] !== c ? (_ = {
35873
35872
  jsUrl: c,
35874
35873
  jsHash: d
@@ -35889,14 +35888,12 @@ ${E}`,
35889
35888
  error: f2
35890
35889
  }), r[7] = f2, r[8] = h2), h2;
35891
35890
  }
35892
- let S;
35893
- r[9] === e.host ? S = r[10] : (S = (_a3 = e.host.closest(`[${RANDOM_ID_ATTR}]`)) == null ? void 0 : _a3.getAttribute(RANDOM_ID_ATTR), r[9] = e.host, r[10] = S);
35894
- let w = S ?? c, E;
35895
- return r[11] !== h || r[12] !== v.default || r[13] !== w || r[14] !== f ? (E = (0, import_jsx_runtime.jsx)(LoadedSlot, {
35891
+ let S = `${d}:${f}`, w;
35892
+ return r[9] !== h || r[10] !== v.default || r[11] !== f || r[12] !== S ? (w = (0, import_jsx_runtime.jsx)(LoadedSlot, {
35896
35893
  widget: v.default,
35897
35894
  modelId: f,
35898
35895
  host: h
35899
- }, w), r[11] = h, r[12] = v.default, r[13] = w, r[14] = f, r[15] = E) : E = r[15], E;
35896
+ }, S), r[9] = h, r[10] = v.default, r[11] = f, r[12] = S, r[13] = w) : w = r[13], w;
35900
35897
  };
35901
35898
  async function runAnyWidgetModule(e, r, c, d, f) {
35902
35899
  d.innerHTML = "";
@@ -65425,7 +65422,7 @@ ${c}
65425
65422
  return Logger.warn("Failed to get version from mount config"), null;
65426
65423
  }
65427
65424
  }
65428
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev20"), showCodeInRunModeAtom = atom(true);
65425
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev22"), showCodeInRunModeAtom = atom(true);
65429
65426
  atom(null);
65430
65427
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
65431
65428
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.22.1-dev20",
3
+ "version": "0.22.1-dev22",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -4,7 +4,6 @@
4
4
  import type { AnyWidget } from "@anywidget/types";
5
5
  import { useEffect, useRef } from "react";
6
6
  import { z } from "zod";
7
- import { RANDOM_ID_ATTR } from "@/core/dom/ui-element-constants";
8
7
  import { useAsyncData } from "@/hooks/useAsyncData";
9
8
  import type { HTMLElementNotDerivedFromRef } from "@/hooks/useEventListener";
10
9
  import { createPlugin } from "@/plugins/core/builder";
@@ -145,18 +144,10 @@ const AnyWidgetSlot = (props: IPluginProps<ModelIdRef, Data>) => {
145
144
  return <ErrorBanner error={error} />;
146
145
  }
147
146
 
148
- // Find the closest parent element with an attribute of `random-id`
149
- const randomId = props.host
150
- .closest(`[${RANDOM_ID_ATTR}]`)
151
- ?.getAttribute(RANDOM_ID_ATTR);
152
- const key = randomId ?? jsUrl;
153
-
154
147
  return (
155
148
  <LoadedSlot
156
- // Use the a key to force a re-render when the randomId (or jsUrl) changes
157
- // Plugins may be stateful and we cannot make assumptions that we won't be
158
- // so it is safer to just re-render.
159
- key={key}
149
+ // Force remount when the widget module or model changes (cell re-run).
150
+ key={`${jsHash}:${modelId}`}
160
151
  widget={jsModule.default}
161
152
  modelId={modelId}
162
153
  host={host}