@marimo-team/islands 0.25.3-dev51 → 0.25.3-dev55
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/{ErrorBoundary-CbxCC2kk.js → ErrorBoundary-DL6Vkcwu.js} +1 -1
- package/dist/{chat-ui-C1Gjgokv.js → chat-ui-C0_lCzql.js} +52 -53
- package/dist/{code-visibility-DoZ9lxzx.js → code-visibility-CtaHItnb.js} +1 -1
- package/dist/{common-D1PacyXO.js → common-Bqcl1bUR.js} +6366 -6327
- package/dist/{data-grid-overlay-editor-B50UpkXd.js → data-grid-overlay-editor-C7NRbnX6.js} +1 -1
- package/dist/{dropdown-menu-MG5hiCIa.js → dropdown-menu-B3eUiVJB.js} +161 -153
- package/dist/{feedback-button-DqPqwryB.js → feedback-button-CpJHBUq4.js} +2 -2
- package/dist/{glide-data-editor-BxMhUd3K.js → glide-data-editor-Cd3d8sya.js} +4 -4
- package/dist/{globals-DTJa_doJ.js → globals-C5LrswXh.js} +1 -1
- package/dist/{html-to-image-By72ALyI.js → html-to-image-6xcoTKhC.js} +1 -1
- package/dist/main.js +2599 -2539
- package/dist/{number-overlay-editor-Z_H6x5b-.js → number-overlay-editor-Do7_pdca.js} +1 -1
- package/dist/{process-output-D-OMW5sV.js → process-output-BJRJFobf.js} +1 -1
- package/dist/{reveal-component-tAB5K3QE.js → reveal-component-CVYLwPCH.js} +12 -12
- package/package.json +1 -1
- package/src/components/app-config/ai-config.tsx +1 -1
- package/src/components/data-table/__tests__/export-actions.test.tsx +17 -0
- package/src/components/data-table/charts/charts.tsx +14 -19
- package/src/components/data-table/export-actions.tsx +5 -3
- package/src/components/editor/actions/__tests__/pair-with-agent-modal.test.tsx +24 -0
- package/src/components/editor/actions/pair-with-agent-modal.tsx +18 -15
- package/src/components/editor/cell/__tests__/useShouldShowInterrupt.test.ts +39 -0
- package/src/components/editor/cell/useShouldShowInterrupt.ts +2 -12
- package/src/components/editor/chrome/panels/__tests__/packages-panel.test.tsx +30 -1
- package/src/components/editor/chrome/panels/packages-panel.tsx +4 -7
- package/src/components/editor/file-tree/__tests__/file-explorer-interactions.test.tsx +6 -0
- package/src/components/editor/file-tree/__tests__/use-file-search.test.tsx +91 -0
- package/src/components/editor/file-tree/file-explorer.tsx +10 -5
- package/src/components/editor/file-tree/use-file-search.ts +35 -21
- package/src/components/icons/__tests__/large-spinner.test.tsx +39 -0
- package/src/components/icons/large-spinner.tsx +3 -14
- package/src/core/network/useConnectionNotice.ts +8 -2
- package/src/hooks/__tests__/useDebounce.test.tsx +51 -0
- package/src/hooks/__tests__/useDeepCompareMemoize.test.tsx +39 -0
- package/src/hooks/__tests__/useDelayElapsed.test.tsx +28 -0
- package/src/hooks/__tests__/useInternalStateWithSync.test.tsx +20 -0
- package/src/hooks/__tests__/useScript.test.tsx +77 -0
- package/src/hooks/__tests__/useStateForKey.test.tsx +257 -0
- package/src/hooks/useDebounce.ts +5 -8
- package/src/hooks/useDeepCompareMemoize.ts +1 -1
- package/src/hooks/useDelayElapsed.ts +14 -10
- package/src/hooks/useInternalStateWithSync.ts +6 -6
- package/src/hooks/useScript.ts +67 -70
- package/src/hooks/useStateForKey.ts +93 -0
- package/src/plugins/impl/DataTablePlugin.tsx +14 -15
- package/src/plugins/impl/FileBrowserPlugin.tsx +4 -16
- package/src/plugins/impl/SliderPlugin.tsx +6 -8
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +117 -1
- package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +45 -0
- package/src/plugins/impl/__tests__/SliderPlugin.test.tsx +24 -3
- package/src/plugins/impl/chat/__tests__/chat-prompts.test.tsx +93 -0
- package/src/plugins/impl/chat/chat-ui.tsx +10 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e } from "./rolldown-runtime-Cb76FRpK.js";
|
|
2
2
|
import { t } from "./react-sHtZdjeP.js";
|
|
3
|
-
import { a as n } from "./glide-data-editor-
|
|
3
|
+
import { a as n } from "./glide-data-editor-Cd3d8sya.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.0_27cffe7f1bc30287d59ac27db3240c5b/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",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { O as e } from "./html-to-image-
|
|
1
|
+
import { O as e } from "./html-to-image-6xcoTKhC.js";
|
|
2
2
|
import { h as t } from "./tooltip-CKO1pHJo.js";
|
|
3
3
|
import { C as n, w as r } from "./error-entries-CMNtA8NK.js";
|
|
4
4
|
import { b as i } from "./select-B0LRDH0g.js";
|
|
@@ -4,14 +4,14 @@ import { t as o } from "./react-sHtZdjeP.js";
|
|
|
4
4
|
import { t as s } from "./compiler-runtime-CldRdSsv.js";
|
|
5
5
|
import { h as c, t as l } from "./tooltip-CKO1pHJo.js";
|
|
6
6
|
import { O as u } from "./error-entries-CMNtA8NK.js";
|
|
7
|
-
import {
|
|
7
|
+
import { Q as d, X as f, Z as p, an as m, cn as h, i as g, in as _, l as v, n as y, r as b, t as x, u as S } from "./common-Bqcl1bUR.js";
|
|
8
8
|
import { M as C } from "./select-B0LRDH0g.js";
|
|
9
|
-
import { q as ee } from "./dropdown-menu-
|
|
9
|
+
import { q as ee } from "./dropdown-menu-B3eUiVJB.js";
|
|
10
10
|
import { _ as w } from "./toDate-CjPuEPou.js";
|
|
11
11
|
import { t as T } from "./jsx-runtime-3BD1kT0s.js";
|
|
12
12
|
import { q as E } from "./use-restore-focus-DBCITLeF.js";
|
|
13
13
|
import { A as D, C as O, b as k } from "./useTheme-DympCsQg.js";
|
|
14
|
-
import { a as A, n as te, t as ne } from "./code-visibility-
|
|
14
|
+
import { a as A, n as te, t as ne } from "./code-visibility-CtaHItnb.js";
|
|
15
15
|
/* empty css */
|
|
16
16
|
var j = 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",
|
|
@@ -6556,7 +6556,7 @@ var sa = (e) => {
|
|
|
6556
6556
|
return t[3] === n ? o = t[4] : (o = /* @__PURE__ */ (0, G.jsx)(ia, { cell: n }), t[3] = n, t[4] = o), o;
|
|
6557
6557
|
}, ca = (e) => {
|
|
6558
6558
|
let n = (0, N.c)(160), { slideCells: o, layout: s, setLayout: c, noOutputIds: u, activeIndex: x, onSlideChange: S, mode: C, configWidth: ee, isEditable: T } = e, j = T !== void 0 && T, re = (0, M.useRef)(null), P = (0, M.useRef)(null), { width: ie, height: ae } = Zi(re), oe = E() != null, F = O(w), I = O(te).kind, se = O(A), ce = I !== "wasm" || se, L;
|
|
6559
|
-
n[0] !== F || n[1] !== I ? (L = F || !
|
|
6559
|
+
n[0] !== F || n[1] !== I ? (L = F || !g(I) ? [] : [Ui], n[0] = F, n[1] = I, n[2] = L) : L = n[2];
|
|
6560
6560
|
let le = L, [ue, de] = (0, M.useState)(la), fe = ne(o), pe;
|
|
6561
6561
|
n[3] === fe ? pe = n[4] : (pe = !k() && fe, n[3] = fe, n[4] = pe);
|
|
6562
6562
|
let me = pe, he;
|
|
@@ -6601,7 +6601,7 @@ var sa = (e) => {
|
|
|
6601
6601
|
let { cellToTarget: Pe, targetToCellIndex: Fe } = Ne, Ie = s.deck?.transition ?? "slide", Le = s.deck?.verticalAlign, Re;
|
|
6602
6602
|
n[37] === Le ? Re = n[38] : (Re = ra(Le), n[37] = Le, n[38] = Re);
|
|
6603
6603
|
let ze = Re, Be;
|
|
6604
|
-
n[39] === Symbol.for("react.memo_cache_sentinel") ? (Be =
|
|
6604
|
+
n[39] === Symbol.for("react.memo_cache_sentinel") ? (Be = y(window.location.href), n[39] = Be) : Be = n[39];
|
|
6605
6605
|
let Ve = Be, H;
|
|
6606
6606
|
n[40] !== Ie || n[41] !== ae || n[42] !== ie ? (H = {
|
|
6607
6607
|
embedded: !0,
|
|
@@ -6751,7 +6751,7 @@ var sa = (e) => {
|
|
|
6751
6751
|
"aria-label": ot ?? void 0,
|
|
6752
6752
|
children: [ot && /* @__PURE__ */ (0, G.jsxs)("div", {
|
|
6753
6753
|
className: "flex items-center gap-1.5 px-3 py-1.5 text-xs text-muted-foreground border-b bg-muted/40",
|
|
6754
|
-
children: [/* @__PURE__ */ (0, G.jsx)(
|
|
6754
|
+
children: [/* @__PURE__ */ (0, G.jsx)(_, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ (0, G.jsx)("span", { children: ot })]
|
|
6755
6755
|
}), /* @__PURE__ */ (0, G.jsx)("div", {
|
|
6756
6756
|
className: "flex-1 overflow-auto flex",
|
|
6757
6757
|
children: /* @__PURE__ */ (0, G.jsx)("div", {
|
|
@@ -6778,7 +6778,7 @@ var sa = (e) => {
|
|
|
6778
6778
|
"aria-disabled": ke,
|
|
6779
6779
|
"aria-label": ke ? "Code always shown" : De ? "Hide code" : "Show code",
|
|
6780
6780
|
onClick: qe,
|
|
6781
|
-
children: /* @__PURE__ */ (0, G.jsx)(
|
|
6781
|
+
children: /* @__PURE__ */ (0, G.jsx)(h, { className: "h-4 w-4" })
|
|
6782
6782
|
})
|
|
6783
6783
|
}), n[124] = De, n[125] = ke, n[126] = R, n[127] = qe, n[128] = gt) : gt = n[128];
|
|
6784
6784
|
let _t;
|
|
@@ -6793,7 +6793,7 @@ var sa = (e) => {
|
|
|
6793
6793
|
onClick: () => {
|
|
6794
6794
|
P.current?.getViewportElement()?.requestFullscreen().catch(pa);
|
|
6795
6795
|
},
|
|
6796
|
-
children: /* @__PURE__ */ (0, G.jsx)(
|
|
6796
|
+
children: /* @__PURE__ */ (0, G.jsx)(m, { className: "h-4 w-4" })
|
|
6797
6797
|
})
|
|
6798
6798
|
}), n[129] = _t) : _t = n[129];
|
|
6799
6799
|
let K;
|
|
@@ -6824,7 +6824,7 @@ var sa = (e) => {
|
|
|
6824
6824
|
}), n[137] = q, n[138] = e), e;
|
|
6825
6825
|
}
|
|
6826
6826
|
let bt;
|
|
6827
|
-
n[139] === q ? bt = n[140] : (bt = /* @__PURE__ */ (0, G.jsx)(
|
|
6827
|
+
n[139] === q ? bt = n[140] : (bt = /* @__PURE__ */ (0, G.jsx)(f, {
|
|
6828
6828
|
defaultSize: 92,
|
|
6829
6829
|
minSize: 60,
|
|
6830
6830
|
children: q
|
|
@@ -6841,7 +6841,7 @@ var sa = (e) => {
|
|
|
6841
6841
|
disabled: oe
|
|
6842
6842
|
}), n[142] = oe, n[143] = J);
|
|
6843
6843
|
let St = ve?.id, Y;
|
|
6844
|
-
n[144] !== s || n[145] !== c || n[146] !== St ? (Y = /* @__PURE__ */ (0, G.jsx)(
|
|
6844
|
+
n[144] !== s || n[145] !== c || n[146] !== St ? (Y = /* @__PURE__ */ (0, G.jsx)(f, {
|
|
6845
6845
|
defaultSize: 10,
|
|
6846
6846
|
minSize: 4,
|
|
6847
6847
|
collapsible: !0,
|
|
@@ -6853,7 +6853,7 @@ var sa = (e) => {
|
|
|
6853
6853
|
})
|
|
6854
6854
|
}), n[144] = s, n[145] = c, n[146] = St, n[147] = Y) : Y = n[147];
|
|
6855
6855
|
let Ct;
|
|
6856
|
-
n[148] !== bt || n[149] !== J || n[150] !== Y ? (Ct = /* @__PURE__ */ (0, G.jsxs)(
|
|
6856
|
+
n[148] !== bt || n[149] !== J || n[150] !== Y ? (Ct = /* @__PURE__ */ (0, G.jsxs)(p, {
|
|
6857
6857
|
direction: "vertical",
|
|
6858
6858
|
autoSaveId: "marimo:slides:notes-panel",
|
|
6859
6859
|
className: "flex-1 min-w-0",
|
|
@@ -6864,7 +6864,7 @@ var sa = (e) => {
|
|
|
6864
6864
|
]
|
|
6865
6865
|
}), n[148] = bt, n[149] = J, n[150] = Y, n[151] = Ct) : Ct = n[151];
|
|
6866
6866
|
let wt;
|
|
6867
|
-
n[152] !== ve || n[153] !== ee || n[154] !== s || n[155] !== c ? (wt = /* @__PURE__ */ (0, G.jsx)(
|
|
6867
|
+
n[152] !== ve || n[153] !== ee || n[154] !== s || n[155] !== c ? (wt = /* @__PURE__ */ (0, G.jsx)(v, {
|
|
6868
6868
|
configWidth: ee,
|
|
6869
6869
|
layout: s,
|
|
6870
6870
|
setLayout: c,
|
package/package.json
CHANGED
|
@@ -1850,7 +1850,7 @@ export const AddModelForm: React.FC<{
|
|
|
1850
1850
|
id={modelNameInputId}
|
|
1851
1851
|
value={modelName}
|
|
1852
1852
|
onChange={(e) => setModelName(e.target.value)}
|
|
1853
|
-
placeholder="gpt-
|
|
1853
|
+
placeholder="gpt-5.6-sol"
|
|
1854
1854
|
className="text-xs mb-0"
|
|
1855
1855
|
/>
|
|
1856
1856
|
</div>
|
|
@@ -531,6 +531,23 @@ describe("ExportActions dialog", () => {
|
|
|
531
531
|
expect(downloadByURL).not.toHaveBeenCalled();
|
|
532
532
|
});
|
|
533
533
|
|
|
534
|
+
it("does not revive an earlier source failure when switching back", async () => {
|
|
535
|
+
downloadAs.mockRejectedValueOnce(new Error("First source failed"));
|
|
536
|
+
const { rerenderExportActions } = renderExportActions({
|
|
537
|
+
metadataSource: "first",
|
|
538
|
+
});
|
|
539
|
+
await openDialog();
|
|
540
|
+
fireEvent.click(screen.getByRole("button", { name: "Download CSV" }));
|
|
541
|
+
expect(await screen.findByRole("alert")).toHaveTextContent(
|
|
542
|
+
"First source failed",
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
rerenderExportActions({ metadataSource: "second" });
|
|
546
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
547
|
+
rerenderExportActions({ metadataSource: "first" });
|
|
548
|
+
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
|
|
549
|
+
});
|
|
550
|
+
|
|
534
551
|
async function startGeoParquetInstall(strictMode = false) {
|
|
535
552
|
const getExportMetadata = vi.fn().mockResolvedValue(geometryMetadata);
|
|
536
553
|
downloadAs.mockResolvedValueOnce({
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
XIcon,
|
|
14
14
|
} from "lucide-react";
|
|
15
15
|
import type { JSX } from "react";
|
|
16
|
-
import React, { useMemo,
|
|
17
|
-
import { type UseFormReturn, useForm } from "react-hook-form";
|
|
16
|
+
import React, { useMemo, useState } from "react";
|
|
17
|
+
import { type UseFormReturn, useForm, useWatch } from "react-hook-form";
|
|
18
18
|
import useResizeObserver from "use-resize-observer";
|
|
19
19
|
import { PythonIcon } from "@/components/editor/cell/code/icons";
|
|
20
20
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
|
@@ -103,16 +103,14 @@ export const TablePanel: React.FC<TablePanelProps> = ({
|
|
|
103
103
|
|
|
104
104
|
const [selectedTab, setSelectedTab] = useState(DEFAULT_TAB_NAME);
|
|
105
105
|
const [tabCounter, setTabCounter] = useState(tabs.length);
|
|
106
|
-
const prevDisplayHeader =
|
|
106
|
+
const [prevDisplayHeader, setPrevDisplayHeader] = useState(displayHeader);
|
|
107
|
+
|
|
108
|
+
if (displayHeader !== prevDisplayHeader) {
|
|
109
|
+
setPrevDisplayHeader(displayHeader);
|
|
110
|
+
}
|
|
107
111
|
|
|
108
112
|
// Auto-create a default chart tab when chart builder opens with no tabs
|
|
109
|
-
if (
|
|
110
|
-
displayHeader &&
|
|
111
|
-
!prevDisplayHeader.current &&
|
|
112
|
-
tabs.length === 0 &&
|
|
113
|
-
cellId
|
|
114
|
-
) {
|
|
115
|
-
prevDisplayHeader.current = displayHeader;
|
|
113
|
+
if (displayHeader && !prevDisplayHeader && tabs.length === 0 && cellId) {
|
|
116
114
|
const tabName = getChartTabName(0, NEW_CHART_TYPE);
|
|
117
115
|
const newTabs = new Map(tabsMap);
|
|
118
116
|
newTabs.set(cellId, [
|
|
@@ -122,7 +120,6 @@ export const TablePanel: React.FC<TablePanelProps> = ({
|
|
|
122
120
|
setTabCounter(1);
|
|
123
121
|
setSelectedTab(tabName);
|
|
124
122
|
}
|
|
125
|
-
prevDisplayHeader.current = displayHeader;
|
|
126
123
|
|
|
127
124
|
if (!displayHeader || (tabs.length === 0 && !displayHeader)) {
|
|
128
125
|
return dataTable;
|
|
@@ -320,9 +317,10 @@ export const ChartPanel: React.FC<{
|
|
|
320
317
|
saveChartType,
|
|
321
318
|
getDataUrl,
|
|
322
319
|
fieldTypes,
|
|
323
|
-
hasSchema
|
|
320
|
+
hasSchema: providedHasSchema,
|
|
324
321
|
isLargeDataset,
|
|
325
322
|
}) => {
|
|
323
|
+
const hasSchema = providedHasSchema ?? Boolean(fieldTypes?.length);
|
|
326
324
|
const { theme } = useTheme();
|
|
327
325
|
const form = useForm<ChartSchemaType>({
|
|
328
326
|
defaultValues: chartConfig ?? getChartDefaults(),
|
|
@@ -370,16 +368,13 @@ export const ChartPanel: React.FC<{
|
|
|
370
368
|
// Re-run when the data table changes
|
|
371
369
|
}, [tableData, renderLargeCharts, csvFieldTypes]);
|
|
372
370
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
const memoizedFormValues = useMemo(() => {
|
|
377
|
-
return structuredClone(formValues);
|
|
378
|
-
}, [formValues]);
|
|
371
|
+
// useWatch returns a new object only when a value changes. It is typed as
|
|
372
|
+
// deeply partial, but the form always starts from complete defaults.
|
|
373
|
+
const formValues = useWatch({ control: form.control }) as ChartSchemaType;
|
|
379
374
|
|
|
380
375
|
const specWithoutData = createSpecWithoutData(
|
|
381
376
|
selectedChartType,
|
|
382
|
-
|
|
377
|
+
formValues,
|
|
383
378
|
theme,
|
|
384
379
|
"container",
|
|
385
380
|
CHART_HEIGHT,
|
|
@@ -24,6 +24,7 @@ import type {
|
|
|
24
24
|
GetExportMetadata,
|
|
25
25
|
} from "./schemas";
|
|
26
26
|
import { useAsyncData } from "@/hooks/useAsyncData";
|
|
27
|
+
import { useStateForKey } from "@/hooks/useStateForKey";
|
|
27
28
|
import { logNever } from "@/utils/assertNever";
|
|
28
29
|
import { cn } from "@/utils/cn";
|
|
29
30
|
import { copyToClipboard } from "@/utils/copy";
|
|
@@ -354,7 +355,6 @@ interface ExportContext {
|
|
|
354
355
|
export const ExportActions: React.FC<ExportActionProps> = (props) => {
|
|
355
356
|
const { getExportMetadata, metadataSource } = props;
|
|
356
357
|
const [exportDialogOpen, setExportDialogOpen] = React.useState(false);
|
|
357
|
-
const [failure, setFailure] = React.useState<ExportFailure | null>(null);
|
|
358
358
|
const [settings, setSettings] =
|
|
359
359
|
React.useState<ExportSettings>(DEFAULT_SETTINGS);
|
|
360
360
|
const [exportContext, setExportContext] = React.useState<ExportContext>(
|
|
@@ -363,6 +363,10 @@ export const ExportActions: React.FC<ExportActionProps> = (props) => {
|
|
|
363
363
|
if (exportContext.source !== metadataSource) {
|
|
364
364
|
setExportContext({ source: metadataSource });
|
|
365
365
|
}
|
|
366
|
+
const [failure, setFailure] = useStateForKey<ExportFailure | null>(
|
|
367
|
+
exportContext,
|
|
368
|
+
() => null,
|
|
369
|
+
);
|
|
366
370
|
const mounted = React.useRef(false);
|
|
367
371
|
const isCurrentContext = useEvent(
|
|
368
372
|
(context: ExportContext) => mounted.current && context === exportContext,
|
|
@@ -416,7 +420,6 @@ export const ExportActions: React.FC<ExportActionProps> = (props) => {
|
|
|
416
420
|
}, []);
|
|
417
421
|
React.useEffect(() => {
|
|
418
422
|
latestActionId.current += 1;
|
|
419
|
-
setFailure(null);
|
|
420
423
|
}, [metadataSource]);
|
|
421
424
|
const policy = useAtomValue(downloadSizeLimitAtom);
|
|
422
425
|
const overLimit = !!(
|
|
@@ -452,7 +455,6 @@ export const ExportActions: React.FC<ExportActionProps> = (props) => {
|
|
|
452
455
|
setExportDialogOpen(open);
|
|
453
456
|
if (!open) {
|
|
454
457
|
latestActionId.current += 1;
|
|
455
|
-
setFailure(null);
|
|
456
458
|
setExpandedFormat(null);
|
|
457
459
|
setSettings(DEFAULT_SETTINGS);
|
|
458
460
|
setGeometryColumn(null);
|
|
@@ -314,6 +314,30 @@ describe("PairWithAgentModal", () => {
|
|
|
314
314
|
expect(screen.getByRole("tabpanel")).not.toHaveTextContent("--notebook");
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
+
it("reverifies the target when host mode is enabled again for the same Session", async () => {
|
|
318
|
+
await act(async () => {
|
|
319
|
+
render(<PairWithAgentModal onClose={vi.fn()} />, { wrapper });
|
|
320
|
+
});
|
|
321
|
+
expect(screen.getByRole("tabpanel")).toHaveTextContent(NOTEBOOK_ID);
|
|
322
|
+
act(() =>
|
|
323
|
+
store.set(pairConfigAtom, { ...PAIR_CONFIG, hostEnabled: false }),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const pending = new Deferred<Response>();
|
|
327
|
+
vi.mocked(fetch).mockImplementation((url) =>
|
|
328
|
+
String(url).endsWith("/api/sessions")
|
|
329
|
+
? pending.promise
|
|
330
|
+
: responseFor(url),
|
|
331
|
+
);
|
|
332
|
+
act(() => store.set(pairConfigAtom, PAIR_CONFIG));
|
|
333
|
+
expect(screen.getByRole("button", { name: "Copy command" })).toBeDisabled();
|
|
334
|
+
expect(screen.getByRole("tabpanel")).not.toHaveTextContent(NOTEBOOK_ID);
|
|
335
|
+
|
|
336
|
+
await act(async () => pending.resolve(await responseFor("/api/sessions")));
|
|
337
|
+
expect(screen.getByRole("button", { name: "Copy command" })).toBeEnabled();
|
|
338
|
+
expect(screen.getByRole("tabpanel")).toHaveTextContent(NOTEBOOK_ID);
|
|
339
|
+
});
|
|
340
|
+
|
|
317
341
|
it("keeps copying disabled when Notebook verification fails", async () => {
|
|
318
342
|
vi.mocked(fetch).mockImplementation((url) =>
|
|
319
343
|
String(url).endsWith("/api/sessions")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
4
|
-
import React, { useEffect, useState } from "react";
|
|
4
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
5
5
|
import { useAtomValue } from "jotai";
|
|
6
6
|
import { Button } from "@/components/ui/button";
|
|
7
7
|
import {
|
|
@@ -53,21 +53,20 @@ export const PairWithAgentModal: React.FC<{
|
|
|
53
53
|
const config = useAtomValue(pairConfigAtom);
|
|
54
54
|
const hostEnabled = config?.hostEnabled ?? false;
|
|
55
55
|
const stableSessionId = useAtomValue(stableSessionIdAtom);
|
|
56
|
+
const lookupIdentity = useMemo(
|
|
57
|
+
() => ({ hostEnabled, stableSessionId }),
|
|
58
|
+
[hostEnabled, stableSessionId],
|
|
59
|
+
);
|
|
56
60
|
const [lookup, setLookup] = useState<
|
|
57
61
|
{
|
|
58
|
-
|
|
59
|
-
} & (
|
|
60
|
-
| { status: "ready"; notebookId: string | null }
|
|
61
|
-
| { status: "loading" | "error" }
|
|
62
|
-
)
|
|
62
|
+
identity: typeof lookupIdentity;
|
|
63
|
+
} & ({ status: "ready"; notebookId: string | null } | { status: "error" })
|
|
63
64
|
>();
|
|
64
65
|
useEffect(() => {
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
const { hostEnabled, stableSessionId: sessionId } = lookupIdentity;
|
|
67
|
+
if (!hostEnabled || !sessionId) {
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
|
-
const sessionId = stableSessionId;
|
|
70
|
-
setLookup({ sessionId, status: "loading" });
|
|
71
70
|
let cancelled = false;
|
|
72
71
|
API.get<Record<string, { session_id: string; notebook_id: string | null }>>(
|
|
73
72
|
"/sessions",
|
|
@@ -79,22 +78,26 @@ export const PairWithAgentModal: React.FC<{
|
|
|
79
78
|
);
|
|
80
79
|
setLookup(
|
|
81
80
|
session
|
|
82
|
-
? {
|
|
83
|
-
|
|
81
|
+
? {
|
|
82
|
+
identity: lookupIdentity,
|
|
83
|
+
status: "ready",
|
|
84
|
+
notebookId: session.notebook_id,
|
|
85
|
+
}
|
|
86
|
+
: { identity: lookupIdentity, status: "error" },
|
|
84
87
|
);
|
|
85
88
|
}
|
|
86
89
|
})
|
|
87
90
|
.catch(() => {
|
|
88
91
|
if (!cancelled) {
|
|
89
|
-
setLookup({
|
|
92
|
+
setLookup({ identity: lookupIdentity, status: "error" });
|
|
90
93
|
}
|
|
91
94
|
});
|
|
92
95
|
return () => {
|
|
93
96
|
cancelled = true;
|
|
94
97
|
};
|
|
95
|
-
}, [
|
|
98
|
+
}, [lookupIdentity]);
|
|
96
99
|
const currentLookup =
|
|
97
|
-
lookup?.
|
|
100
|
+
lookup?.identity === lookupIdentity ? lookup : undefined;
|
|
98
101
|
const verified = !hostEnabled || currentLookup?.status === "ready";
|
|
99
102
|
const notebookId =
|
|
100
103
|
hostEnabled && currentLookup?.status === "ready"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { act, renderHook } from "@testing-library/react";
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import { useShouldShowInterrupt } from "../useShouldShowInterrupt";
|
|
6
|
+
|
|
7
|
+
describe("useShouldShowInterrupt", () => {
|
|
8
|
+
beforeEach(() => vi.useFakeTimers());
|
|
9
|
+
afterEach(() => vi.useRealTimers());
|
|
10
|
+
|
|
11
|
+
it("waits for each run and hides immediately when it stops", () => {
|
|
12
|
+
const { result, rerender } = renderHook(useShouldShowInterrupt, {
|
|
13
|
+
initialProps: false,
|
|
14
|
+
});
|
|
15
|
+
expect(result.current).toBe(false);
|
|
16
|
+
rerender(true);
|
|
17
|
+
expect(result.current).toBe(false);
|
|
18
|
+
act(() => vi.advanceTimersByTime(200));
|
|
19
|
+
expect(result.current).toBe(true);
|
|
20
|
+
rerender(false);
|
|
21
|
+
expect(result.current).toBe(false);
|
|
22
|
+
rerender(true);
|
|
23
|
+
expect(result.current).toBe(false);
|
|
24
|
+
act(() => vi.advanceTimersByTime(199));
|
|
25
|
+
expect(result.current).toBe(false);
|
|
26
|
+
act(() => vi.advanceTimersByTime(1));
|
|
27
|
+
expect(result.current).toBe(true);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("cancels the delay for a short run", () => {
|
|
31
|
+
const { result, rerender } = renderHook(useShouldShowInterrupt, {
|
|
32
|
+
initialProps: true,
|
|
33
|
+
});
|
|
34
|
+
act(() => vi.advanceTimersByTime(100));
|
|
35
|
+
rerender(false);
|
|
36
|
+
act(() => vi.advanceTimersByTime(200));
|
|
37
|
+
expect(result.current).toBe(false);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
import {
|
|
2
|
+
import { useDelayElapsed } from "@/hooks/useDelayElapsed";
|
|
3
3
|
|
|
4
4
|
const DELAY_MS = 200;
|
|
5
5
|
|
|
@@ -10,17 +10,7 @@ const DELAY_MS = 200;
|
|
|
10
10
|
export function useShouldShowInterrupt(running: boolean) {
|
|
11
11
|
// Start a timer when the run starts.
|
|
12
12
|
// After 200ms, show the interrupt button to avoid flickering.
|
|
13
|
-
const
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (!running) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
setHasRunLongEnough(false);
|
|
19
|
-
const timeout = setTimeout(() => {
|
|
20
|
-
setHasRunLongEnough(true);
|
|
21
|
-
}, DELAY_MS);
|
|
22
|
-
return () => clearTimeout(timeout);
|
|
23
|
-
}, [running]);
|
|
13
|
+
const hasRunLongEnough = useDelayElapsed(running ? DELAY_MS : 0);
|
|
24
14
|
|
|
25
15
|
return running && hasRunLongEnough;
|
|
26
16
|
}
|
|
@@ -18,7 +18,10 @@ import type {
|
|
|
18
18
|
DependencyTreeNode,
|
|
19
19
|
DependencyTreeResponse,
|
|
20
20
|
} from "@/core/network/types";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
invalidatePackageData,
|
|
23
|
+
withPackageInvalidation,
|
|
24
|
+
} from "@/core/packages/package-data";
|
|
22
25
|
import { useInstallPackages } from "@/core/packages/useInstallPackage";
|
|
23
26
|
import { sandboxAtom, sandboxSyncAtom } from "@/core/packages/sandbox-state";
|
|
24
27
|
import { store } from "@/core/state/jotai";
|
|
@@ -143,6 +146,32 @@ describe("PackagesPanel", () => {
|
|
|
143
146
|
expect(screen.queryByText("cycle")).not.toBeInTheDocument();
|
|
144
147
|
});
|
|
145
148
|
|
|
149
|
+
it("collapses expanded nodes when the dependency tree is refreshed", async () => {
|
|
150
|
+
const { client } = renderPanel(
|
|
151
|
+
{ kind: "sandbox", backend: "pixi" },
|
|
152
|
+
populatedTree,
|
|
153
|
+
);
|
|
154
|
+
fireEvent.click(await screen.findByRole("treeitem", { name: /polars/ }));
|
|
155
|
+
expect(screen.getByText("already in tree")).toBeInTheDocument();
|
|
156
|
+
|
|
157
|
+
vi.mocked(client.getDependencyTree).mockResolvedValue({
|
|
158
|
+
tree: structuredClone(populatedTree),
|
|
159
|
+
context: { kind: "sandbox", backend: "pixi" },
|
|
160
|
+
});
|
|
161
|
+
act(() => invalidatePackageData());
|
|
162
|
+
|
|
163
|
+
await waitFor(() =>
|
|
164
|
+
expect(client.getDependencyTree).toHaveBeenCalledTimes(2),
|
|
165
|
+
);
|
|
166
|
+
await waitFor(() =>
|
|
167
|
+
expect(screen.queryByText("already in tree")).not.toBeInTheDocument(),
|
|
168
|
+
);
|
|
169
|
+
expect(screen.getByRole("treeitem", { name: /polars/ })).toHaveAttribute(
|
|
170
|
+
"aria-expanded",
|
|
171
|
+
"false",
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
146
175
|
it("keeps the configured package manager changeable outside a sandbox", async () => {
|
|
147
176
|
const { getPackageList } = renderPanel({
|
|
148
177
|
kind: "package-manager",
|
|
@@ -31,6 +31,7 @@ import { usePackageAction } from "@/core/packages/usePackageAction";
|
|
|
31
31
|
import { usePackageDependencies } from "@/core/packages/usePackageDependencies";
|
|
32
32
|
import { useInstallPackages } from "@/core/packages/useInstallPackage";
|
|
33
33
|
import { isWasm } from "@/core/wasm/utils";
|
|
34
|
+
import { useStateForKey } from "@/hooks/useStateForKey";
|
|
34
35
|
import { ErrorBanner } from "@/plugins/impl/common/error-banner";
|
|
35
36
|
import { cn } from "@/utils/cn";
|
|
36
37
|
import { copyToClipboard } from "@/utils/copy";
|
|
@@ -440,15 +441,11 @@ const DependencyTree: React.FC<{
|
|
|
440
441
|
error?: Error | null;
|
|
441
442
|
sandboxBackend: "uv" | "pixi" | null;
|
|
442
443
|
}> = ({ tree, error, sandboxBackend }) => {
|
|
443
|
-
const [expandedNodes, setExpandedNodes] =
|
|
444
|
-
|
|
444
|
+
const [expandedNodes, setExpandedNodes] = useStateForKey(
|
|
445
|
+
tree,
|
|
446
|
+
() => new Set<string>(),
|
|
445
447
|
);
|
|
446
448
|
|
|
447
|
-
// Reset tree to collapsed state when tree data changes (including refetches)
|
|
448
|
-
React.useEffect(() => {
|
|
449
|
-
setExpandedNodes(new Set());
|
|
450
|
-
}, [tree]);
|
|
451
|
-
|
|
452
449
|
if (error) {
|
|
453
450
|
return <ErrorBanner error={error} />;
|
|
454
451
|
}
|
|
@@ -137,5 +137,11 @@ describe("FileExplorer upload destination", () => {
|
|
|
137
137
|
}),
|
|
138
138
|
).toBeVisible();
|
|
139
139
|
expect(screen.queryByText(".hidden")).not.toBeInTheDocument();
|
|
140
|
+
|
|
141
|
+
fireEvent.click(screen.getByTestId("file-explorer-hidden-files-button"));
|
|
142
|
+
expect(await screen.findByText(".hidden")).toBeVisible();
|
|
143
|
+
expect(
|
|
144
|
+
screen.getByRole("button", { name: "Upload files to workspace" }),
|
|
145
|
+
).toBeVisible();
|
|
140
146
|
});
|
|
141
147
|
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { act, renderHook, waitFor } from "@testing-library/react";
|
|
4
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
+
import type { EditRequests } from "@/core/network/types";
|
|
6
|
+
import { Deferred } from "@/utils/Deferred";
|
|
7
|
+
import { RequestingTree } from "../requesting-tree";
|
|
8
|
+
import { useFileSearch } from "../use-file-search";
|
|
9
|
+
|
|
10
|
+
const sendSearchFiles = vi.hoisted(() =>
|
|
11
|
+
vi.fn<EditRequests["sendSearchFiles"]>(),
|
|
12
|
+
);
|
|
13
|
+
vi.mock("@/core/network/requests", () => ({
|
|
14
|
+
useRequestClient: () => ({ sendSearchFiles }),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
describe("useFileSearch", () => {
|
|
18
|
+
let tree: RequestingTree;
|
|
19
|
+
|
|
20
|
+
beforeEach(async () => {
|
|
21
|
+
sendSearchFiles.mockReset();
|
|
22
|
+
tree = new RequestingTree({
|
|
23
|
+
getRoots: vi.fn().mockResolvedValue({
|
|
24
|
+
roots: [{ path: "/root", name: "workspace", isPrimary: true }],
|
|
25
|
+
}),
|
|
26
|
+
listFiles: vi.fn().mockResolvedValue({ files: [], root: "/root" }),
|
|
27
|
+
createFileOrFolder: vi.fn(),
|
|
28
|
+
deleteFileOrFolder: vi.fn(),
|
|
29
|
+
copyFileOrFolder: vi.fn(),
|
|
30
|
+
renameFileOrFolder: vi.fn(),
|
|
31
|
+
});
|
|
32
|
+
await tree.initialize(() => undefined);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("derives loading for a refetch and a changed hidden-file filter", async () => {
|
|
36
|
+
sendSearchFiles.mockResolvedValue({
|
|
37
|
+
files: [],
|
|
38
|
+
query: "file",
|
|
39
|
+
totalFound: 0,
|
|
40
|
+
});
|
|
41
|
+
const { result, rerender } = renderHook(
|
|
42
|
+
({ showHiddenFiles }) =>
|
|
43
|
+
useFileSearch({ query: "file", tree, showHiddenFiles }),
|
|
44
|
+
{ initialProps: { showHiddenFiles: false } },
|
|
45
|
+
);
|
|
46
|
+
await waitFor(() => expect(result.current.state.status).toBe("success"));
|
|
47
|
+
|
|
48
|
+
const pending = new Deferred<
|
|
49
|
+
Awaited<ReturnType<EditRequests["sendSearchFiles"]>>
|
|
50
|
+
>();
|
|
51
|
+
sendSearchFiles.mockReturnValue(pending.promise);
|
|
52
|
+
act(() => result.current.refetch());
|
|
53
|
+
expect(result.current.state.status).toBe("loading");
|
|
54
|
+
await act(async () =>
|
|
55
|
+
pending.resolve({ files: [], query: "file", totalFound: 0 }),
|
|
56
|
+
);
|
|
57
|
+
expect(result.current.state.status).toBe("success");
|
|
58
|
+
|
|
59
|
+
sendSearchFiles.mockReturnValue(new Promise(() => undefined));
|
|
60
|
+
rerender({ showHiddenFiles: true });
|
|
61
|
+
expect(result.current.state.status).toBe("loading");
|
|
62
|
+
await waitFor(() =>
|
|
63
|
+
expect(sendSearchFiles).toHaveBeenLastCalledWith(
|
|
64
|
+
expect.objectContaining({ includeHidden: true }),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("keeps superseded scans serial and ignores their results", async () => {
|
|
70
|
+
const first = new Deferred<
|
|
71
|
+
Awaited<ReturnType<EditRequests["sendSearchFiles"]>>
|
|
72
|
+
>();
|
|
73
|
+
sendSearchFiles
|
|
74
|
+
.mockReturnValueOnce(first.promise)
|
|
75
|
+
.mockResolvedValue({ files: [], query: "file", totalFound: 0 });
|
|
76
|
+
const { result } = renderHook(() =>
|
|
77
|
+
useFileSearch({ query: "file", tree, showHiddenFiles: false }),
|
|
78
|
+
);
|
|
79
|
+
await waitFor(() => expect(sendSearchFiles).toHaveBeenCalledOnce());
|
|
80
|
+
|
|
81
|
+
act(() => result.current.refetch());
|
|
82
|
+
expect(sendSearchFiles).toHaveBeenCalledOnce();
|
|
83
|
+
expect(result.current.state.status).toBe("loading");
|
|
84
|
+
await act(async () =>
|
|
85
|
+
first.resolve({ files: [], query: "file", totalFound: 0 }),
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
expect(sendSearchFiles).toHaveBeenCalledTimes(2);
|
|
89
|
+
expect(result.current.state.status).toBe("success");
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -201,11 +201,16 @@ export const FileExplorer: React.FC<{
|
|
|
201
201
|
() => filterHiddenTree(data, showHiddenFiles),
|
|
202
202
|
[data, showHiddenFiles],
|
|
203
203
|
);
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
204
|
+
const selectedFolderId = selectedFolder?.id;
|
|
205
|
+
const selectedFolderVisible = React.useMemo(
|
|
206
|
+
() =>
|
|
207
|
+
selectedFolderId === undefined ||
|
|
208
|
+
treeContainsId(visibleData, selectedFolderId),
|
|
209
|
+
[visibleData, selectedFolderId],
|
|
210
|
+
);
|
|
211
|
+
if (!selectedFolderVisible) {
|
|
212
|
+
setSelectedFolder(null);
|
|
213
|
+
}
|
|
209
214
|
const contextValue = React.useMemo<FileExplorerContextValue>(
|
|
210
215
|
() => ({
|
|
211
216
|
tree,
|