@marimo-team/frontend 0.24.1-dev13 → 0.24.1-dev18
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/assets/{cell-editor-B1XuGiJU.js → cell-editor-DZg8uKWr.js} +14 -14
- package/dist/assets/{command-palette-BmVRprpP.js → command-palette-fK5U3VCd.js} +1 -1
- package/dist/assets/{edit-page-COptmWLK.js → edit-page-DUnHDaYA.js} +4 -4
- package/dist/assets/{index-CvqoLM43.js → index-Dqr3-dR1.js} +2 -2
- package/dist/assets/{layout-CsRkTidf.js → layout-YbL5eg7A.js} +2 -2
- package/dist/assets/{panels-DnBAh8y9.js → panels-Bhzy-m2X.js} +1 -1
- package/dist/assets/{reveal-component-DgFIj2TQ.js → reveal-component-CnIgubBp.js} +1 -1
- package/dist/assets/{run-page-CCZKEWid.js → run-page-Du8ylzny.js} +1 -1
- package/dist/assets/{scratchpad-panel-DXuBKn4N.js → scratchpad-panel-BEn7TrAb.js} +1 -1
- package/dist/assets/{skeleton-DapNw_f4.js → skeleton-CL2xKYhl.js} +1 -1
- package/dist/assets/{useNotebookActions-Dd3eLoIZ.js → useNotebookActions-CblNR75b.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/core/codemirror/code-lens/__tests__/popover.test.ts +13 -0
- package/src/core/codemirror/code-lens/popover.tsx +11 -5
|
@@ -56,6 +56,19 @@ describe("CachePopover getCacheInfo throttling", () => {
|
|
|
56
56
|
return () => act(() => dispose());
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
it("renders content synchronously for CodeMirror's initial measurement", async () => {
|
|
60
|
+
const dom = document.createElement("div");
|
|
61
|
+
|
|
62
|
+
// Keep the mount outside `act()`. It would flush an asynchronous render
|
|
63
|
+
// and make this assertion pass without `flushSync`.
|
|
64
|
+
const dispose = mountLensPopover(dom, CACHE_SPEC);
|
|
65
|
+
|
|
66
|
+
expect(dom.textContent).toContain("my_cache");
|
|
67
|
+
await act(async () => {
|
|
68
|
+
dispose();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
59
72
|
it("does not refetch on every hover, only after the throttle interval elapses", () => {
|
|
60
73
|
const disposeFirst = mount();
|
|
61
74
|
expect(getCacheInfoMock).toHaveBeenCalledTimes(1);
|
|
@@ -4,6 +4,7 @@ import { Provider, useAtomValue } from "jotai";
|
|
|
4
4
|
import { DatabaseZapIcon } from "lucide-react";
|
|
5
5
|
import type React from "react";
|
|
6
6
|
import { useEffect } from "react";
|
|
7
|
+
import { flushSync } from "react-dom";
|
|
7
8
|
import { createRoot } from "react-dom/client";
|
|
8
9
|
import { useLocale } from "react-aria";
|
|
9
10
|
import { ProtocolIcon } from "@/components/storage/components";
|
|
@@ -39,11 +40,16 @@ export function mountLensPopover(
|
|
|
39
40
|
spec: CodeLensSpec,
|
|
40
41
|
): () => void {
|
|
41
42
|
const root = createRoot(dom);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
// CodeMirror measures and positions the tooltip as soon as this function
|
|
44
|
+
// returns. Render now so it measures the popover content, not an empty
|
|
45
|
+
// container that later grows over the hovered icon.
|
|
46
|
+
flushSync(() => {
|
|
47
|
+
root.render(
|
|
48
|
+
<Provider store={store}>
|
|
49
|
+
<LensPopover spec={spec} />
|
|
50
|
+
</Provider>,
|
|
51
|
+
);
|
|
52
|
+
});
|
|
47
53
|
// Defer so tearing the tooltip down from inside a React event (e.g. the
|
|
48
54
|
// icon's click handler) doesn't unmount mid-render
|
|
49
55
|
return () => queueMicrotask(() => root.unmount());
|