Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: anywidget remote url (#5279)

Myles Scolnick6163187334c1
diff --git a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
index 7fc8d8bcac..d3b4b2e653 100644
--- a/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
+++ b/frontend/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx
@@ -19,6 +19,7 @@ import { MarimoIncomingMessageEvent } from "@/core/dom/events";
import { updateBufferPaths } from "@/utils/data-views";
import { Model, MODEL_MANAGER } from "./model";
import { isEqual } from "lodash-es";
+import { asRemoteURL } from "@/core/runtime/config";
interface Data {
jsUrl: string;
@@ -62,8 +63,7 @@ const AnyWidgetSlot = (props: Props) => {
// export function render({ model, el }) {
// ...
const { data: module, error } = useAsyncData(async () => {
- const baseUrl = document.baseURI;
- const url = new URL(jsUrl, baseUrl).toString();
+ const url = asRemoteURL(jsUrl).toString();
return await import(/* @vite-ignore */ url);
// Re-render on jsHash change instead of url change (since URLs may change)
}, [jsHash]);