Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Upgrade to React 19 (#79642)

Romeo Van Snick095012cb9483
diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index f55626abb4e..ebae69eb331 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -25,6 +25,7 @@ import "@mantine/dates/styles.css";
import { Global, css, useTheme } from "@emotion/react";
import { initialize, mswLoader } from "msw-storybook-addon";
+import { loadCodeEditor } from "metabase/common/components/CodeEditor";
import { OverlayStackProvider } from "metabase/ui/components/overlays/overlay-stack";
import { EmotionCacheProvider } from "metabase/ui/components/theme/EmotionCacheProvider";
import {
@@ -204,7 +205,12 @@ const preview = {
// registry would otherwise be captured mid-Suspense, showing the skeleton.
// Wrapped because a loader is called with the story context, which would
// otherwise be taken for the list of displays to load.
- loaders: [mswLoader, fontsReady, () => loadVisualizationComponents()],
+ loaders: [
+ mswLoader,
+ fontsReady,
+ () => loadVisualizationComponents(),
+ () => loadCodeEditor(),
+ ],
argTypes,
};
diff --git a/bin/embedding-sdk/change-react-version.bash b/bin/embedding-sdk/change-react-version.bash
index f65fc07ce38..221e79f7b18 100755
--- a/bin/embedding-sdk/change-react-version.bash
+++ b/bin/embedding-sdk/change-react-version.bash
@@ -4,6 +4,34 @@ function restore_package_files() {
git checkout -- bun.lock package.json
}
+function pin_react_resolutions() {
+ # `resolutions` overrides every react/react-dom version, so a plain `bun add
+ # react@^18` still installs the version pinned there. Rewrite the pins to the
+ # target major first, otherwise the React 18 job silently runs React 19.
+ local version=$1
+ node -e '
+ const fs = require("fs");
+ const pkg = JSON.parse(fs.readFileSync("package.json", "utf8"));
+ const range = "^" + process.argv[1] + ".0.0";
+ for (const key of ["react", "react-dom", "@types/react", "@types/react-dom"]) {
+ if (pkg.resolutions && key in pkg.resolutions) {
+ pkg.resolutions[key] = range;
+ }
+ }
+ fs.writeFileSync("package.json", JSON.stringify(pkg, null, 2) + "\n");
+ ' "$version"
+}
+
+function assert_react_version() {
+ local version=$1
+ local installed=$(node -e 'console.log(require("react/package.json").version)')
+ if [[ "$installed" != "$version."* ]]; then
+ echo "Error: expected React $version.x but node_modules has $installed"
+ exit 1
+ fi
+ echo "React $installed is installed"
+}
+
function install_packages() {
local version=$1
local cypress_react_package=$(get_cypress_react_package "$version")
@@ -14,9 +42,13 @@ function install_packages() {
exit 1
fi
+ pin_react_resolutions "$version"
+
# Install React and Cypress React test harness
echo "Installing $dependencies"
bun add $dependencies
+
+ assert_react_version "$version"
}
function print_usage() {
diff --git a/bun.lock b/bun.lock
index 765f2af8048..41bf72623f0 100644
--- a/bun.lock
+++ b/bun.lock
@@ -25,10 +25,10 @@
"@dnd-kit/modifiers": "^6.0.1",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
- "@emotion/cache": "^11.11.0",
+ "@emotion/cache": "^11.14.0",
"@emotion/is-prop-valid": "^1.1.1",
- "@emotion/react": "^11.11.0",
- "@emotion/styled": "^11.11.0",
+ "@emotion/react": "^11.14.0",
+ "@emotion/styled": "^11.14.0",
"@floating-ui/dom": "^1.7.4",
"@floating-ui/react": "^0.27.16",
"@juggle/resize-observer": "^3.4.0",
@@ -120,12 +120,12 @@
"prosemirror-state": "^1.4.4",
"prosemirror-view": "^1.42.3",
"querystring-es3": "^0.2.1",
- "react": "^18.2.0",
+ "react": "^19.0.0",
"react-ansi-style": "^1.0.0",
"react-color": "^2.14.1",
"react-dnd": "4",
"react-dnd-html5-backend": "4",
- "react-dom": "^18.2.0",
+ "react-dom": "^19.0.0",
"react-dropzone": "^14.2.3",
"react-grid-layout": "^1.5.3",
"react-is": "^18.2.0",
@@ -168,7 +168,7 @@
"@cypress/code-coverage": "^4.0.3",
"@cypress/grep": "^6",
"@cypress/react": "^9",
- "@emotion/babel-plugin": "^11.11.0",
+ "@emotion/babel-plugin": "^11.13.5",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@eslint/compat": "2.0.2",
"@eslint/js": "9.39.2",
@@ -228,9 +228,9 @@
"@types/mustache": "^4.1.2",
"@types/postcss-import": "^14.0.3",
"@types/postcss-url": "^10.0.4",
- "@types/react": "^18.3.3",
+ "@types/react": "^19.0.0",
"@types/react-color": "^2.17.6",
- "@types/react-dom": "^18.2.17",
+ "@types/react-dom": "^19.0.0",
"@types/react-grid-layout": "^1.3.5",
"@types/react-is": "^18.2.4",
"@types/react-resizable": "^3.0.4",
@@ -376,6 +376,9 @@
"esbuild",
"cypress",
],
+ "patchedDependencies": {
+ "@loki/[email protected]": "patches/@loki%[email protected]",
+ },
"overrides": {
"@codemirror/autocomplete": "^6.18.6",
"@codemirror/commands": "^6.10.1",
@@ -387,6 +390,8 @@
"@lezer/common": "^1.5.0",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2",
+ "@types/react": "^19.0.0",
+ "@types/react-dom": "^19.0.0",
"ansi-regex": "5.0.1",
"cross-spawn": "^7.0.5",
"csstype": "^3.2.3",
@@ -401,6 +406,8 @@
"prosemirror-transform": "^1.12.1",
"prosemirror-view": "^1.42.3",
"qs": "6.16.0",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
"redux": "5.0.1",
"webpack": "5.105.0",
},
@@ -643,7 +650,7 @@
"@babel/preset-typescript": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-validator-option": "^7.27.1", "@babel/plugin-syntax-jsx": "^7.27.1", "@babel/plugin-transform-modules-commonjs": "^7.27.1", "@babel/plugin-transform-typescript": "^7.27.1" } }, "sha512-l7WfQfX0WK4M0v2RudjuQK4u99BS6yLHYEmdtVPP7lKV013zr9DygFuWNlnbvQ9LR+LS0Egz/XAvGx5U9MX0fQ=="],
- "@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+ "@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA=="],
"@babel/template": ["@babel/[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.29.7", "@babel/parser": "^7.29.7", "@babel/types": "^7.29.7" } }, "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg=="],
@@ -835,31 +842,31 @@
"@emnapi/wasi-threads": ["@emnapi/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="],
- "@emotion/babel-plugin": ["@emotion/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.16.7", "@babel/runtime": "^7.18.3", "@emotion/hash": "^0.9.1", "@emotion/memoize": "^0.8.1", "@emotion/serialize": "^1.1.2", "babel-plugin-macros": "^3.1.0", "convert-source-map": "^1.5.0", "escape-string-regexp": "^4.0.0", "find-root": "^1.1.0", "source-map": "^0.5.7", "stylis": "4.2.0" } }, "sha512-m4HEDZleaaCH+XgDDsPF15Ht6wTLsgDTeR3WYj9Q/k76JtWhrJjcP4+/XlG8LGT/Rol9qUfOIztXeA84ATpqPQ=="],
+ "@emotion/babel-plugin": ["@emotion/[email protected]", "", { "dependencies": { "@babel/helper-module-imports": "^7.16.7", "@babel/runtime": "^7.18.3", "@emotion/hash": "^0.9.2", "@emotion/memoize": "^0.9.0", "@emotion/serialize": "^1.3.3", "babel-plugin-macros": "^3.1.0", "convert-source-map": "^1.5.0", "escape-string-regexp": "^4.0.0", "find-root": "^1.1.0", "source-map": "^0.5.7", "stylis": "4.2.0" } }, "sha512-pxHCpT2ex+0q+HH91/zsdHkw/lXd468DIN2zvfvLtPKLLMo6gQj7oLObq8PhkrxOZb/gGCq03S3Z7PDhS8pduQ=="],
- "@emotion/cache": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.8.1", "@emotion/sheet": "^1.2.2", "@emotion/utils": "^1.2.1", "@emotion/weak-memoize": "^0.3.1", "stylis": "4.2.0" } }, "sha512-P34z9ssTCBi3e9EI1ZsWpNHcfY1r09ZO0rZbRO2ob3ZQMnFI35jB536qoXbkdesr5EUhYi22anuEJuyxifaqAQ=="],
+ "@emotion/cache": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.9.0", "@emotion/sheet": "^1.4.0", "@emotion/utils": "^1.4.2", "@emotion/weak-memoize": "^0.4.0", "stylis": "4.2.0" } }, "sha512-L/B1lc/TViYk4DcpGxtAVbx0ZyiKM5ktoIyafGkH6zg/tj+mA+NE//aPYKG0k8kCHSHVJrpLpcAlOBEXQ3SavA=="],
- "@emotion/hash": ["@emotion/[email protected]", "", {}, "sha512-gJB6HLm5rYwSLI6PQa+X1t5CFGrv1J1TWG+sOyMCeKz2ojaj6Fnl/rZEspogG+cvqbt4AE/2eIyD2QfLKTBNlQ=="],
+ "@emotion/hash": ["@emotion/[email protected]", "", {}, "sha512-MyqliTZGuOm3+5ZRSaaBGP3USLw6+EGykkwZns2EPC5g8jJ4z9OrdZY9apkl3+UP9+sdz76YYkwCKP5gh8iY3g=="],
"@emotion/is-prop-valid": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.8.1" } }, "sha512-61Mf7Ufx4aDxx1xlDeOm8aFFigGHE4z+0sKCa+IHCeZKiyP9RLD0Mmx7m8b9/Cf37f7NAvQOOJAbQQGVr5uERw=="],
- "@emotion/memoize": ["@emotion/[email protected]", "", {}, "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA=="],
+ "@emotion/memoize": ["@emotion/[email protected]", "", {}, "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ=="],
- "@emotion/react": ["@emotion/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.11.0", "@emotion/cache": "^11.11.0", "@emotion/serialize": "^1.1.3", "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", "@emotion/utils": "^1.2.1", "@emotion/weak-memoize": "^0.3.1", "hoist-non-react-statics": "^3.3.1" } }, "sha512-t8AjMlF0gHpvvxk5mAtCqR4vmxiGHCeJBaQO6gncUSdklELOgtwjerNY2yuJNfwnc6vi16U/+uMF+afIawJ9iw=="],
+ "@emotion/react": ["@emotion/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", "@emotion/cache": "^11.14.0", "@emotion/serialize": "^1.3.3", "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", "@emotion/utils": "^1.4.2", "@emotion/weak-memoize": "^0.4.0", "hoist-non-react-statics": "^3.3.1" }, "peerDependencies": { "@types/react": "*", "react": ">=16.8.0" }, "optionalPeers": ["@types/react"] }, "sha512-O000MLDBDdk/EohJPFUqvnp4qnHeYkVP5B0xEG0D/L7cOKP9kefu2DXn8dj74cQfsEzUqh+sr1RzFqiL1o+PpA=="],
- "@emotion/serialize": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/hash": "^0.9.1", "@emotion/memoize": "^0.8.1", "@emotion/unitless": "^0.8.1", "@emotion/utils": "^1.2.1", "csstype": "^3.0.2" } }, "sha512-zR6a/fkFP4EAcCMQtLOhIgpprZOwNmCldtpaISpvz348+DP4Mz8ZoKaGGCQpbzepNIUWbq4w6hNZkwDyKoS+HA=="],
+ "@emotion/serialize": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/hash": "^0.9.2", "@emotion/memoize": "^0.9.0", "@emotion/unitless": "^0.10.0", "@emotion/utils": "^1.4.2", "csstype": "^3.0.2" } }, "sha512-EISGqt7sSNWHGI76hC7x1CksiXPahbxEOrC5RjmFRJTqLyEK9/9hZvBbiYn70dw4wuwMKiEMCUlR6ZXTSWQqxA=="],
- "@emotion/sheet": ["@emotion/[email protected]", "", {}, "sha512-0QBtGvaqtWi+nx6doRwDdBIzhNdZrXUppvTM4dtZZWEGTXL/XE/yJxLMGlDT1Gt+UHH5IX1n+jkXyytE/av7OA=="],
+ "@emotion/sheet": ["@emotion/[email protected]", "", {}, "sha512-fTBW9/8r2w3dXWYM4HCB1Rdp8NLibOw2+XELH5m5+AkWiL/KqYX6dc0kKYlaYyKjrQ6ds33MCdMPEwgs2z1rqg=="],
- "@emotion/styled": ["@emotion/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.11.0", "@emotion/is-prop-valid": "^1.2.2", "@emotion/serialize": "^1.1.4", "@emotion/use-insertion-effect-with-fallbacks": "^1.0.1", "@emotion/utils": "^1.2.1" } }, "sha512-/ZjjnaNKvuMPxcIiUkf/9SHoG4Q196DRl1w82hQ3WCsjo1IUR8uaGWrC6a87CrYAW0Kb/pK7hk8BnLgLRi9KoQ=="],
+ "@emotion/styled": ["@emotion/[email protected]", "", { "dependencies": { "@babel/runtime": "^7.18.3", "@emotion/babel-plugin": "^11.13.5", "@emotion/is-prop-valid": "^1.3.0", "@emotion/serialize": "^1.3.3", "@emotion/use-insertion-effect-with-fallbacks": "^1.2.0", "@emotion/utils": "^1.4.2" }, "peerDependencies": { "@emotion/react": "^11.0.0-rc.0", "@types/react": "*", "react": ">=16.8.0" }, "optionalPeers": ["@types/react"] }, "sha512-qEEJt42DuToa3gurlH4Qqc1kVpNq8wO8cJtDzU46TjlzWjDlsVyevtYCRijVq3SrHsROS+gVQ8Fnea108GnKzw=="],
- "@emotion/unitless": ["@emotion/[email protected]", "", {}, "sha512-KOEGMu6dmJZtpadb476IsZBclKvILjopjUii3V+7MnXIQCYh8W3NgNcgwo21n9LXZX6EDIKvqfjYxXebDwxKmQ=="],
+ "@emotion/unitless": ["@emotion/[email protected]", "", {}, "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg=="],
- "@emotion/use-insertion-effect-with-fallbacks": ["@emotion/[email protected]", "", {}, "sha512-jT/qyKZ9rzLErtrjGgdkMBn2OP8wl0G3sQlBb3YPryvKHsjvINUhVaPFfP+fpBcOkmrVOVEEHQFJ7nbj2TH2gw=="],
+ "@emotion/use-insertion-effect-with-fallbacks": ["@emotion/[email protected]", "", { "peerDependencies": { "react": ">=16.8.0" } }, "sha512-yJMtVdH59sxi/aVJBpk9FQq+OR8ll5GT8oWd57UpeaKEVGab41JWaCFA7FRLoMLloOZF/c/wsPoe+bfGmRKgDg=="],
- "@emotion/utils": ["@emotion/[email protected]", "", {}, "sha512-Y2tGf3I+XVnajdItskUCn6LX+VUDmP6lTL4fcqsXAv43dnlbZiuW4MWQW38rW/BVWSE7Q/7+XQocmpnRYILUmg=="],
+ "@emotion/utils": ["@emotion/[email protected]", "", {}, "sha512-3vLclRofFziIa3J2wDh9jjbkUz9qk5Vi3IZ/FSTKViB0k+ef0fPV7dYrUIugbgupYDx7v9ud/SjrtEP8Y4xLoA=="],
- "@emotion/weak-memoize": ["@emotion/[email protected]", "", {}, "sha512-EsBwpc7hBUJWAsNPBmJy4hxWx12v6bshQsldrVmjxJoc3isbxhOrF2IcCpaXxfvq03NwkI7sbsOLXbYuqF/8Ww=="],
+ "@emotion/weak-memoize": ["@emotion/[email protected]", "", {}, "sha512-snKqtPW01tN0ui7yu9rGv69aJXr/a/Ywvl11sUjNtEcRc+ng/mQriFL0wLXMef74iHa/EkftbDzU9F8iFbH+zg=="],
"@epic-web/invariant": ["@epic-web/[email protected]", "", {}, "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA=="],
@@ -1913,11 +1920,11 @@
"@types/raf": ["@types/[email protected]", "", {}, "sha512-taW5/WYqo36N7V39oYyHP9Ipfd5pNFvGTIQsNGj86xV88YQ7GnI30/yMfKDF7Zgin0m3e+ikX88FvImnK4RjGw=="],
- "@types/react": ["@types/[email protected]", "", { "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" } }, "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw=="],
+ "@types/react": ["@types/[email protected]", "", { "dependencies": { "csstype": "^3.2.2" } }, "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg=="],
"@types/react-color": ["@types/[email protected]", "", { "dependencies": { "@types/react": "*", "@types/reactcss": "*" } }, "sha512-5CEKnrpvgZz8v5UYbpLgBeK+V6K7KdszksSDK6mNjL/8wrsqQfIyKB45CQOAEYtRgn+tWqTeqbUtvFWjXDpURQ=="],
- "@types/react-dom": ["@types/[email protected]", "", { "dependencies": { "@types/react": "*" } }, "sha512-o/V48vf4MQh7juIKZU2QGDfli6p1+OOi5oXx36Hffpc9adsHeXjVp8rHuPkjd8VT8sOJ2Zp05HR7CdpGTIUFUA=="],
+ "@types/react-dom": ["@types/[email protected]", "", { "peerDependencies": { "@types/react": "^19.3.0" } }, "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q=="],
"@types/react-grid-layout": ["@types/[email protected]", "", { "dependencies": { "@types/react": "*" } }, "sha512-WH/po1gcEcoR6y857yAnPGug+ZhkF4PaTUxgAbwfeSH/QOgVSakKHBXoPGad/sEznmkiaK3pqHk+etdWisoeBQ=="],
@@ -4503,7 +4510,7 @@
"rc9": ["[email protected]", "", { "dependencies": { "defu": "^6.1.6", "destr": "^2.0.5" } }, "sha512-gMDyleLWVE+i6Sgtc0QbbY6pEKqYs97NGi6isHQPqYlLemPoO8dxQ3uGi0f4NiP98c+jMW6cG1Kx9dDwfvqARQ=="],
- "react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ=="],
+ "react": ["[email protected]", "", {}, "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw=="],
"react-ansi-style": ["[email protected]", "", { "dependencies": { "ansi-style-parser": "^1.0.1", "js-managed-css": "^1.4.1" } }, "sha1-mx1Mju38VvTc81mjliGEZYw+jAk="],
@@ -4519,7 +4526,7 @@
"react-docgen-typescript": ["[email protected]", "", {}, "sha512-tvg2ZtOpOi6QDwsb3GZhOjDkkX0h8Z2gipvTg6OVMUyoYoURhEiRNePT8NZItTVCDh39JJHnLdfCOkzoLbFnTg=="],
- "react-dom": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.0" } }, "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g=="],
+ "react-dom": ["[email protected]", "", { "dependencies": { "scheduler": "^0.28.0" }, "peerDependencies": { "react": "^19.3.1" } }, "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ=="],
"react-draggable": ["[email protected]", "", { "dependencies": { "clsx": "^2.1.1", "prop-types": "^15.8.1" }, "peerDependencies": { "react": ">= 16.3.0", "react-dom": ">= 16.3.0" } }, "sha512-VC+HBLEZ0XJxnOxVAZsdRi8rD04Iz3SiiKOoYzamjylUcju/hP9np/aZdLHf/7WOD268WMoNJMvYfB5yAK45cw=="],
@@ -4745,7 +4752,7 @@
"saxes": ["[email protected]", "", { "dependencies": { "xmlchars": "^2.2.0" } }, "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA=="],
- "scheduler": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw=="],
+ "scheduler": ["[email protected]", "", {}, "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw=="],
"schema-utils": ["[email protected]", "", { "dependencies": { "@types/json-schema": "^7.0.9", "ajv": "^8.8.0", "ajv-formats": "^2.1.1", "ajv-keywords": "^5.0.0" } }, "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg=="],
@@ -5467,11 +5474,9 @@
"@emotion/babel-plugin/convert-source-map": ["[email protected]", "", { "dependencies": { "safe-buffer": "~5.1.1" } }, "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA=="],
- "@emotion/react/@emotion/serialize": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/hash": "^0.9.1", "@emotion/memoize": "^0.8.1", "@emotion/unitless": "^0.8.1", "@emotion/utils": "^1.2.1", "csstype": "^3.0.2" } }, "sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ=="],
-
- "@emotion/styled/@emotion/is-prop-valid": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.8.1" } }, "sha512-uNsoYd37AFmaCdXlg6EYD1KaPOaRWRByMCYzbKUX4+hhMfrxdVSelShywL4JVaAeM/eHUOSprYBQls+/neX3pw=="],
+ "@emotion/is-prop-valid/@emotion/memoize": ["@emotion/[email protected]", "", {}, "sha512-W2P2c/VRW1/1tLox0mVUalvnWXxavmv/Oum2aPsRcoDJuob75FC3Y8FbpfLwUegRcxINtGUMPq0tFCvYNTBXNA=="],
- "@emotion/styled/@emotion/serialize": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/hash": "^0.9.1", "@emotion/memoize": "^0.8.1", "@emotion/unitless": "^0.8.1", "@emotion/utils": "^1.2.1", "csstype": "^3.0.2" } }, "sha512-RIN04MBT8g+FnDwgvIUi8czvr1LU1alUMI05LekWB5DGyTm8cCBMCRpq3GqaiyEDRptEXOyXnvZ58GZYu4kBxQ=="],
+ "@emotion/styled/@emotion/is-prop-valid": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.9.0" } }, "sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw=="],
"@eslint-community/eslint-utils/eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
@@ -5565,8 +5570,6 @@
"@loki/runner/minimist": ["[email protected]", "", {}, "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q=="],
- "@loki/runner/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0", "object-assign": "^4.1.1" } }, "sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA=="],
-
"@loki/target-chrome-docker/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.3", "get-stream": "^6.0.0", "human-signals": "^2.1.0", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.1", "onetime": "^5.1.2", "signal-exit": "^3.0.3", "strip-final-newline": "^2.0.0" } }, "sha512-ov6w/2LCiuyO4RLYGdpFGjkcs0wMTgGE8PrkTHikeUy5iJekXyPIKUjifk5CsE0pt7sMCrMZ3YNqoCj6idQOnQ=="],
"@loki/target-native-android-emulator/tempy": ["[email protected]", "", { "dependencies": { "del": "^6.0.0", "is-stream": "^2.0.0", "temp-dir": "^2.0.0", "type-fest": "^0.16.0", "unique-string": "^2.0.0" } }, "sha512-biM9brNqxSc04Ee71hzFbryD11nX7VPhQQY32AdDmjFvodsRFz/3ufeoTZ6uYkRFfGo188tENcASNs3vTdsM0w=="],
@@ -5593,13 +5596,17 @@
"@parcel/watcher/detect-libc": ["[email protected]", "", { "bin": { "detect-libc": "./bin/detect-libc.js" } }, "sha512-pGjwhsmsp4kL2RTz08wcOlGN83otlqHeD/Z5T8GXZB+/YcpQ/dgo+lbU8ZsGxV0HIvqqxo9l7mqYwyYMD9bKDg=="],
- "@redocly/cli/ajv": ["@redocly/[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-BieiCML/IgP6x99HZByJSt7fJE4ipgzO7KAFss92Bs+PEI35BhY7vGIysFXLT+YmS7nHtQjZjhOQyPPEf7xGHA=="],
+ "@radix-ui/react-compose-refs/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
- "@redocly/cli/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.3.1", "jackspeak": "^4.1.1", "minimatch": "^10.1.1", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw=="],
+ "@radix-ui/react-portal/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
- "@redocly/cli/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="],
+ "@radix-ui/react-primitive/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
- "@redocly/cli/react-dom": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" } }, "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw=="],
+ "@radix-ui/react-slot/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
+ "@redocly/cli/ajv": ["@redocly/[email protected]", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-BieiCML/IgP6x99HZByJSt7fJE4ipgzO7KAFss92Bs+PEI35BhY7vGIysFXLT+YmS7nHtQjZjhOQyPPEf7xGHA=="],
+
+ "@redocly/cli/glob": ["[email protected]", "", { "dependencies": { "foreground-child": "^3.3.1", "jackspeak": "^4.1.1", "minimatch": "^10.1.1", "minipass": "^7.1.2", "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw=="],
"@redocly/cli/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA=="],
@@ -5645,10 +5652,6 @@
"@snowplow/tracker-core/uuid": ["[email protected]", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ=="],
- "@storybook/addon-docs/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="],
-
- "@storybook/addon-docs/react-dom": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" } }, "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw=="],
-
"@storybook/addon-measure/tiny-invariant": ["[email protected]", "", {}, "sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg=="],
"@storybook/addon-webpack5-compiler-babel/babel-loader": ["[email protected]", "", { "dependencies": { "find-cache-dir": "^4.0.0", "schema-utils": "^4.0.0" } }, "sha512-fqe8naHt46e0yIdkjUZYqddSXfej3AHajX+CSO5X7oy0EmPc6o5Xh+RClNoHjnieWz9AW4kZxW9yyFMhVB1QLA=="],
@@ -5699,12 +5702,18 @@
"@svgr/plugin-svgo/deepmerge": ["[email protected]", "", {}, "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A=="],
+ "@testing-library/cypress/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
+ "@testing-library/dom/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"@testing-library/jest-dom/aria-query": ["[email protected]", "", {}, "sha512-V+SM7AbUwJ+EBnB8+DXs0hPZHO0W6pqBcc0dW90OwtVG02PswOu/teuARoLQjdDOH+t9pJgGnW5/Qmouf3gPJg=="],
"@testing-library/jest-dom/chalk": ["[email protected]", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg=="],
"@testing-library/jest-dom/dom-accessibility-api": ["[email protected]", "", {}, "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w=="],
+ "@testing-library/react/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"@ts-morph/common/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
"@tybys/wasm-util/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
@@ -5737,6 +5746,8 @@
"@typescript-eslint/visitor-keys/@typescript-eslint/types": ["@typescript-eslint/[email protected]", "", {}, "sha512-ArDdaOllnCj3yn/lzKn9s0pBQYmmyme/v1HbGIGB0GB/knFI3fWMHloC+oYTJW46tVbYnGKTMDK4ah1sC2v0Kg=="],
+ "@uiw/react-codemirror/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"@unrs/resolver-binding-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/[email protected]", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.10.0" } }, "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ=="],
"@visx/curve/@types/d3-shape": ["@types/[email protected]", "", { "dependencies": { "@types/d3-path": "^1" } }, "sha512-8oMzcd4+poSLGgV0R1Q1rOlx/xdmozS4Xab7np0eamFFUYq71AU9pOCJEFnkXW2aI/oXdVYJzw6pssbSut7Z9Q=="],
@@ -5827,6 +5838,8 @@
"babel-plugin-jest-hoist/@types/babel__core": ["@types/[email protected]", "", { "dependencies": { "@babel/parser": "^7.20.7", "@babel/types": "^7.20.7", "@types/babel__generator": "*", "@types/babel__template": "*", "@types/babel__traverse": "*" } }, "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA=="],
+ "babel-plugin-macros/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"babel-plugin-macros/cosmiconfig": ["[email protected]", "", { "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", "parse-json": "^5.0.0", "path-type": "^4.0.0", "yaml": "^1.10.0" } }, "sha512-pondGvTuVYDk++upghXJabWzL6Kxu6f26ljFw64Swq9v6sQPUL3EUlVDV56diOjpCayKihL6hVe8exIACU4XcA=="],
"babel-plugin-macros/resolve": ["[email protected]", "", { "dependencies": { "is-core-module": "^2.2.0", "path-parse": "^1.0.6" } }, "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A=="],
@@ -5871,6 +5884,8 @@
"camelcase-keys/camelcase": ["[email protected]", "", {}, "sha512-DLIsRzJVBQu72meAKPkWQOLcujdXT32hwdfnkI1frSiSRMK1MofjKHf+MEx0SB6fjEFXL8fBDv1dKymBlOp4Qw=="],
+ "canvg/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"canvg/core-js": ["[email protected]", "", {}, "sha512-ZNS5nbiSwDTq4hFosEDqm65izl2CWmLz0hARJMyNQBgkUZMIF51cQiMvIQKA6hvuaeWxQDP3hEedM1JZIgTldQ=="],
"chokidar/fsevents": ["[email protected]", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
@@ -5941,6 +5956,8 @@
"data-urls/whatwg-url": ["[email protected]", "", { "dependencies": { "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" } }, "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw=="],
+ "date-fns/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"debug/ms": ["[email protected]", "", {}, "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="],
"deep-equal/array-buffer-byte-length": ["[email protected]", "", { "dependencies": { "call-bind": "^1.0.5", "is-array-buffer": "^3.0.4" } }, "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg=="],
@@ -5997,6 +6014,8 @@
"diffie-hellman/bn.js": ["[email protected]", "", {}, "sha512-E6QoYqCKZfgatHTdHzs1RRKP7ip4vvm+EyRUeE2RF0NblwVvb0p6jSVeNTOFxPn26QXN2o6SMfNxKp6kU8zQaw=="],
+ "dom-helpers/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"dot-case/tslib": ["[email protected]", "", {}, "sha512-gS9GVHRU+RGn5KQM2rllAlR3dU6m7AcpJKdtH8gFvQiC4Otgk98XnmMU+nZenHt/+VhnBPWwgrJsyrdcw6i23w=="],
"ecdsa-sig-formatter/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
@@ -6069,6 +6088,8 @@
"eslint-plugin-jest/@typescript-eslint/utils": ["@typescript-eslint/[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.9.1", "@typescript-eslint/scope-manager": "8.54.0", "@typescript-eslint/types": "8.54.0", "@typescript-eslint/typescript-estree": "8.54.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-9Cnda8GS57AQakvRyG0PTejJNlA2xhvyNtEVIMlDWOOeEyBkYWhGPnfrIAnqxLMTSTo6q8g12XVjjev5l1NvMA=="],
+ "eslint-plugin-jest-dom/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"eslint-plugin-jest-dom/requireindex": ["[email protected]", "", {}, "sha512-L9jEkOi3ASd9PYit2cwRfyppc9NoABujTP8/5gFcbERmo5jUoAKovIC3fsF17pkTnGsrByysqX+Kxd2OTNI1ww=="],
"eslint-plugin-react/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
@@ -6317,12 +6338,12 @@
"jsdom/whatwg-url": ["[email protected]", "", { "dependencies": { "tr46": "^5.1.0", "webidl-conversions": "^7.0.0" } }, "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw=="],
+ "json-schema-to-ts/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"json-stable-stringify/call-bind": ["[email protected]", "", { "dependencies": { "es-define-property": "^1.0.0", "es-errors": "^1.3.0", "function-bind": "^1.1.2", "get-intrinsic": "^1.2.4", "set-function-length": "^1.2.1" } }, "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w=="],
"jsonwebtoken/semver": ["[email protected]", "", { "dependencies": { "lru-cache": "^6.0.0" }, "bin": { "semver": "bin/semver.js" } }, "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA=="],
- "jspdf/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA=="],
-
"jsx-ast-utils/array-includes": ["[email protected]", "", { "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "es-abstract": "^1.18.0-next.2", "get-intrinsic": "^1.1.1", "is-string": "^1.0.5" } }, "sha512-gcem1KlBU7c9rB+Rq8/3PPKsK2kjqeEBa3bD5kkQo4nYlOHQCJqIJFqBXDEfwaRuYTT4E+FxA9xez7Gf/e3Q7A=="],
"jwa/safe-buffer": ["[email protected]", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
@@ -6539,6 +6560,8 @@
"pkg-types/exsolve": ["[email protected]", "", {}, "sha512-VO5fQUzZtI6C+vx4w/4BWJpg3s/5l+6pRQEHzFRM8WFi4XffSP1Z+4qi7GbjWbvRQEbdIco5mIMq+zX4rPuLrw=="],
+ "polished/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"postcss-import/resolve": ["[email protected]", "", { "dependencies": { "path-parse": "^1.0.6" } }, "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w=="],
"postcss-load-config/yaml": ["[email protected]", "", {}, "sha512-vIYeF1u3CjlhAFekPPAk2h/Kv4T3mAkMox5OymRiJQB0spDP10LHvt+K7G9Ny6NuuMAb25/6n1qyUjAcGNf/AA=="],
@@ -6615,8 +6638,14 @@
"react-style-singleton/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
+ "react-textarea-autosize/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
+ "react-transition-group/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"react-use/tslib": ["[email protected]", "", {}, "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="],
+ "react-virtualized/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"react-virtualized/clsx": ["[email protected]", "", {}, "sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA=="],
"read-cache/pify": ["[email protected]", "", {}, "sha1-7RQaasBDqEnqWISY59yosVMw6Qw="],
@@ -6673,6 +6702,8 @@
"router/path-to-regexp": ["[email protected]", "", {}, "sha512-PuseHIvAnz3bjrM2rGJtSgo1zjgxapTLZ7x2pjhzWwlp4SJQgK3f3iZIQwkpEnBaKz6seKBADpM4B4ySkuYypg=="],
+ "rtl-css-js/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"rxjs/tslib": ["[email protected]", "", {}, "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q=="],
"sass/chokidar": ["[email protected]", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
@@ -6735,8 +6766,6 @@
"styled-components/@emotion/is-prop-valid": ["@emotion/[email protected]", "", { "dependencies": { "@emotion/memoize": "^0.9.0" } }, "sha512-QgD4fyscGcbbKwJmqNvUMSE02OsHUa+lAWKdEUIJKgqe5IwRSKd7+KhibEWdaKwgjLj0DRSHA9biAIqGBk05lw=="],
- "styled-components/@emotion/unitless": ["@emotion/[email protected]", "", {}, "sha512-dFoMUuQA20zvtVTuxZww6OHoJYgrzfKM1t52mVySDJnMSEa08ruEvdYQbhvyu6soU+NeLVd3yKfTfT0NeV6qGg=="],
-
"styled-components/postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA=="],
"styled-components/stylis": ["[email protected]", "", {}, "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ=="],
@@ -6929,6 +6958,8 @@
"yargs-unparser/decamelize": ["[email protected]", "", {}, "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ=="],
+ "yup/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"yup/@types/lodash": ["@types/[email protected]", "", {}, "sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw=="],
"zrender/tslib": ["[email protected]", "", {}, "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg=="],
@@ -7065,8 +7096,6 @@
"@redocly/cli/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^5.0.2" } }, "sha512-ugkC31VaVg9cF0DFVoADH12k6061zNZkZON+aX8AWsR9GhPcErkcMBceb6znR8wLERM2AkkOxy2nWRLpT9Jq5w=="],
- "@redocly/cli/react-dom/scheduler": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="],
-
"@rolldown/binding-wasm32-wasi/@emnapi/core/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
"@rolldown/binding-wasm32-wasi/@emnapi/runtime/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
@@ -7079,8 +7108,6 @@
"@rspack/binding-wasm32-wasi/@napi-rs/wasm-runtime/@tybys/wasm-util": ["@tybys/[email protected]", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg=="],
- "@storybook/addon-docs/react-dom/scheduler": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ=="],
-
"@storybook/addon-webpack5-compiler-babel/babel-loader/find-cache-dir": ["[email protected]", "", { "dependencies": { "common-path-prefix": "^3.0.0", "pkg-dir": "^7.0.0" } }, "sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg=="],
"@storybook/builder-webpack5/css-loader/postcss-modules-extract-imports": ["[email protected]", "", {}, "sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q=="],
@@ -7105,6 +7132,8 @@
"@storybook/react-docgen-typescript-plugin/flat-cache/rimraf": ["[email protected]", "", { "dependencies": { "glob": "^7.1.3" }, "bin": { "rimraf": "bin.js" } }, "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA=="],
+ "@storybook/test/@testing-library/dom/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-Q/N6JNWvIvPnLDvjlE1OUBLPQHH6l3CltCEsHIujp45zQUSSh8K+gHnaEX45yAT1nyngnINhvWtzN+Nb9D8RAQ=="],
+
"@storybook/test/@testing-library/dom/dom-accessibility-api": ["[email protected]", "", {}, "sha512-R305kwb5CcMDIpSHUnLyIAp7SrSPBx6F0VfQFB3M75xVMHhXJJIdePYgbPPh1o57vCHNu5QztokWUPsLjWzFqw=="],
"@svgr/core/cosmiconfig/parse-json": ["[email protected]", "", { "dependencies": { "@babel/code-frame": "^7.0.0", "error-ex": "^1.3.1", "json-parse-even-better-errors": "^2.3.0", "lines-and-columns": "^1.1.6" } }, "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg=="],
@@ -7175,8 +7204,6 @@
"babel-plugin-ttag/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="],
- "babel-plugin-ttag/babel-plugin-macros/@babel/runtime": ["@babel/[email protected]", "", {}, "sha512-05WQkdpL9COIMz4LjTxGpPNCdlpyimKppYNoJ5Di5EUObifl8t4tuLuUBBZEpoLYOmfvIWrsp9fCl0HoPRVTdA=="],
-
"babel-plugin-ttag/babel-plugin-macros/cosmiconfig": ["[email protected]", "", { "dependencies": { "@types/parse-json": "^4.0.0", "import-fresh": "^3.1.0", "parse-json": "^5.0.0", "path-type": "^4.0.0", "yaml": "^1.7.2" } }, "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg=="],
"babel-plugin-ttag/babel-plugin-macros/resolve": ["[email protected]", "", { "dependencies": { "path-parse": "^1.0.6" } }, "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w=="],
@@ -7775,8 +7802,6 @@
"spawn-wrap/which/isexe": ["[email protected]", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
- "styled-components/@emotion/is-prop-valid/@emotion/memoize": ["@emotion/[email protected]", "", {}, "sha512-30FAj7/EoJ5mwVPOWhAyCX+FPfMDrVecJAM+Iw9NRoSl4BBAQeqj4cApHHUXOVvIPgLVDsCFoz/hGD+5QQD1GQ=="],
-
"stylelint/file-entry-cache/flat-cache": ["[email protected]", "", { "dependencies": { "cacheable": "^2.1.0", "flatted": "^3.3.3", "hookified": "^1.12.0" } }, "sha512-JUPnFgHMuAVmLmoH9/zoZ6RHOt5n9NlUw/sDXsTbROJ2SFoS2DS4s+swAV6UTeTbGH/CAsZIE6M8TaG/3jVxgQ=="],
"stylus/glob/minimatch": ["[email protected]", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw=="],
diff --git a/e2e/embedding-sdk-host-apps/vite-6-data-app-host-app/src/App.tsx b/e2e/embedding-sdk-host-apps/vite-6-data-app-host-app/src/App.tsx
index 68e1b9990b9..c0f0e6030b5 100644
--- a/e2e/embedding-sdk-host-apps/vite-6-data-app-host-app/src/App.tsx
+++ b/e2e/embedding-sdk-host-apps/vite-6-data-app-host-app/src/App.tsx
@@ -14,8 +14,19 @@ const OrdersQuery = defineQuery({
const ALLOWED_URL = "https://allowed.data-app.test/ping";
const BLOCKED_URL = "https://blocked.data-app.test/ping";
+// The dev React build re-invokes effects (StrictMode) and the SDK remounts the
+// app once while its store initializes, so an unguarded probe fires these
+// requests a non-deterministic number of times and the diagnostics counts drift
+// between runs. Fire exactly once per page load (the flag resets on reload) so
+// the blocked-request assertions are stable.
+let hasProbed = false;
+
function SandboxProbe() {
useEffect(() => {
+ if (hasProbed) {
+ return;
+ }
+ hasProbed = true;
fetch(ALLOWED_URL).catch(() => {});
fetch(BLOCKED_URL).catch(() => {});
}, []);
diff --git a/e2e/test/scenarios/dashboard/dashcard-resizing.cy.spec.js b/e2e/test/scenarios/dashboard/dashcard-resizing.cy.spec.js
index a363343df2a..c8511077c80 100644
--- a/e2e/test/scenarios/dashboard/dashcard-resizing.cy.spec.js
+++ b/e2e/test/scenarios/dashboard/dashcard-resizing.cy.spec.js
@@ -482,6 +482,10 @@ describe("issue 29304", () => {
// cypress runs all tests in an iframe and the app uses this property to avoid embedding mode for all tests
// by removing the property the app would work in embedding mode
window.Cypress = undefined;
+ // Load charts up front so the lazy Suspense boundary never suspends.
+ // Nulling Cypress above also nulls isCypressActive, which keeps the
+ // frozen clock from advancing React 19's lazy retry (metabase#29304).
+ window.METABASE_LOAD_ALL_VISUALIZATIONS = true;
},
});
H.closeNavigationSidebar();
diff --git a/enterprise/frontend/src/embedding-sdk-ee/metabot/MetabotQuestion.stories.tsx b/enterprise/frontend/src/embedding-sdk-ee/metabot/MetabotQuestion.stories.tsx
index 99d549aacd6..86b8a4c2360 100644
--- a/enterprise/frontend/src/embedding-sdk-ee/metabot/MetabotQuestion.stories.tsx
+++ b/enterprise/frontend/src/embedding-sdk-ee/metabot/MetabotQuestion.stories.tsx
@@ -1,6 +1,5 @@
-import type { StoryFn } from "@storybook/react";
import { HttpResponse, http } from "msw";
-import type { ComponentProps } from "react";
+import type { ComponentType } from "react";
import { getStorybookSdkAuthConfigForUser } from "embedding-sdk-bundle/test/CommonSdkStoryWrapper";
import { MetabotQuestion } from "embedding-sdk-package";
@@ -16,8 +15,6 @@ import { Flex, Stack } from "metabase/ui";
// side effect to activate the plugin
import "./MetabotQuestion";
-type MetabotQuestionProps = ComponentProps<typeof MetabotQuestion>;
-
const config = getStorybookSdkAuthConfigForUser("admin");
export default {
@@ -27,7 +24,7 @@ export default {
layout: "fullscreen",
},
decorators: [
- (Story: StoryFn) => (
+ (Story: ComponentType) => (
<MetabaseProvider authConfig={config}>
<Story />
</MetabaseProvider>
@@ -36,7 +33,7 @@ export default {
],
};
-const Template: StoryFn<MetabotQuestionProps> = () => {
+const Template = () => {
return <MetabotQuestion height="100vh" />;
};
diff --git a/enterprise/frontend/src/embedding-sdk-ee/metabot/hooks/use-metabot.stories.utils.tsx b/enterprise/frontend/src/embedding-sdk-ee/metabot/hooks/use-metabot.stories.utils.tsx
index 2eb55809861..6bd496210bb 100644
--- a/enterprise/frontend/src/embedding-sdk-ee/metabot/hooks/use-metabot.stories.utils.tsx
+++ b/enterprise/frontend/src/embedding-sdk-ee/metabot/hooks/use-metabot.stories.utils.tsx
@@ -134,7 +134,7 @@ export const MessageList = ({
}: {
messages: MetabotMessage[];
isProcessing: boolean;
- scrollRef: React.RefObject<HTMLDivElement>;
+ scrollRef: React.RefObject<HTMLDivElement | null>;
palette: MessageListPalette;
onRetry?: (messageId: string) => void;
}) => (
diff --git a/enterprise/frontend/src/embedding-sdk-package/components/private/ComponentWrapper/ComponentWrapper.tsx b/enterprise/frontend/src/embedding-sdk-package/components/private/ComponentWrapper/ComponentWrapper.tsx
index 2f5d7a3ee04..377afcf1802 100644
--- a/enterprise/frontend/src/embedding-sdk-package/components/private/ComponentWrapper/ComponentWrapper.tsx
+++ b/enterprise/frontend/src/embedding-sdk-package/components/private/ComponentWrapper/ComponentWrapper.tsx
@@ -76,7 +76,7 @@ const Box = ({
// the SDK bundle loading is not triggered.
// We wait for 1 second and if the loading state is still not set or Initial - we set the NotStartedLoading error
const NotStartedLoadingTrigger = () => {
- const timeoutRef = useRef<number>();
+ const timeoutRef = useRef<number>(undefined);
useEffect(function handleSdkBundleNotStartedLoadingState() {
timeoutRef.current = window.setTimeout(() => {
diff --git a/enterprise/frontend/src/embedding-sdk-package/test/getHostedBundleStoryDecorator.tsx b/enterprise/frontend/src/embedding-sdk-package/test/getHostedBundleStoryDecorator.tsx
index 4fa4c294056..d24542d341d 100644
--- a/enterprise/frontend/src/embedding-sdk-package/test/getHostedBundleStoryDecorator.tsx
+++ b/enterprise/frontend/src/embedding-sdk-package/test/getHostedBundleStoryDecorator.tsx
@@ -1,12 +1,12 @@
// eslint-disable-next-line eslint-js/no-restricted-imports
import { MantineProvider } from "@mantine/core";
-import type { StoryContext, StoryFn } from "@storybook/react";
-import { useEffect } from "react";
+import type { StoryContext } from "@storybook/react";
+import { type ComponentType, useEffect } from "react";
import { deleteConflictingCljsGlobals } from "metabase/embedding-sdk/test/delete-conflicting-cljs-globals";
export const getHostedBundleStoryDecorator = () =>
- function useDecorator(Story: StoryFn, context: StoryContext) {
+ function useDecorator(Story: ComponentType, context: StoryContext) {
useEffect(() => {
deleteConflictingCljsGlobals();
diff --git a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx
index 2a4a62c8c06..08749196619 100644
--- a/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx
+++ b/enterprise/frontend/src/embedding/data-picker/saved-entity-picker/SavedEntityList.tsx
@@ -1,4 +1,4 @@
-import { Fragment } from "react";
+import { Fragment, type JSX } from "react";
import { t } from "ttag";
import { skipToken, useListCollectionItemsQuery } from "metabase/api";
diff --git a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/McpToolsAccessPage/components/McpToolsGrid/use-group-column-virtualizer.ts b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/McpToolsAccessPage/components/McpToolsGrid/use-group-column-virtualizer.ts
index 8064cb87e56..0e0791e59c4 100644
--- a/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/McpToolsAccessPage/components/McpToolsGrid/use-group-column-virtualizer.ts
+++ b/enterprise/frontend/src/metabase-enterprise/ai-controls/pages/McpToolsAccessPage/components/McpToolsGrid/use-group-column-virtualizer.ts
@@ -8,7 +8,7 @@ import {
} from "./constants";
export type GroupColumnVirtualizer = {
- scrollRef: RefObject<HTMLDivElement>;
+ scrollRef: RefObject<HTMLDivElement | null>;
virtualColumns: VirtualItem[];
leadingSpacerWidth: number;
trailingSpacerWidth: number;
diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/OidcButton/OidcButton.tsx b/enterprise/frontend/src/metabase-enterprise/auth/components/OidcButton/OidcButton.tsx
index befed208f01..de285385389 100644
--- a/enterprise/frontend/src/metabase-enterprise/auth/components/OidcButton/OidcButton.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/auth/components/OidcButton/OidcButton.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import {
AuthCardButton,
diff --git a/enterprise/frontend/src/metabase-enterprise/auth/components/SsoButton/SsoButton.tsx b/enterprise/frontend/src/metabase-enterprise/auth/components/SsoButton/SsoButton.tsx
index 355eae12dcb..e6d168bf37b 100644
--- a/enterprise/frontend/src/metabase-enterprise/auth/components/SsoButton/SsoButton.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/auth/components/SsoButton/SsoButton.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect } from "react";
+import { type JSX, useCallback, useEffect } from "react";
import { t } from "ttag";
import {
diff --git a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForDatabases.unit.spec.tsx b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForDatabases.unit.spec.tsx
index 170559ca72c..f6040c6243a 100644
--- a/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForDatabases.unit.spec.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/caching/components/StrategyEditorForDatabases.unit.spec.tsx
@@ -489,17 +489,20 @@ describe("StrategyEditorForDatabases (search)", () => {
await userEvent.type(searchInput, "Database 10");
+ // The search filters asynchronously, and under React 19 the non-matching
+ // rows drop a render after the default policy row does. Wait for a
+ // non-matching row to leave before asserting the filtered result.
await waitFor(() => {
expect(
screen.queryByLabelText(/Edit default policy/),
).not.toBeInTheDocument();
+ expect(
+ screen.queryByLabelText(/Edit policy for database 'Database 11'/),
+ ).not.toBeInTheDocument();
});
expect(
screen.getByLabelText(/Edit policy for database 'Database 10'/),
).toBeInTheDocument();
- expect(
- screen.queryByLabelText(/Edit policy for database 'Database 11'/),
- ).not.toBeInTheDocument();
});
});
diff --git a/enterprise/frontend/src/metabase-enterprise/moderation/components/EntityModerationIcon/EntityModerationIcon.tsx b/enterprise/frontend/src/metabase-enterprise/moderation/components/EntityModerationIcon/EntityModerationIcon.tsx
index 58c2c75990d..9035f52f3e4 100644
--- a/enterprise/frontend/src/metabase-enterprise/moderation/components/EntityModerationIcon/EntityModerationIcon.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/moderation/components/EntityModerationIcon/EntityModerationIcon.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { ModerationReview } from "metabase-types/api";
import ModerationReviewIcon from "../../containers/ModerationReviewIcon";
diff --git a/enterprise/frontend/src/metabase-enterprise/moderation/components/ModerationReviewIcon/ModerationReviewIcon.tsx b/enterprise/frontend/src/metabase-enterprise/moderation/components/ModerationReviewIcon/ModerationReviewIcon.tsx
index 2445ae96729..1aab517815a 100644
--- a/enterprise/frontend/src/metabase-enterprise/moderation/components/ModerationReviewIcon/ModerationReviewIcon.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/moderation/components/ModerationReviewIcon/ModerationReviewIcon.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Icon, Text, Tooltip } from "metabase/ui";
import { getRelativeTime } from "metabase/utils/time-dayjs";
import type { ModerationReview, User } from "metabase-types/api";
diff --git a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantsSummaryOnboardingStep/TenantsSummaryOnboardingStep.unit.spec.ts b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantsSummaryOnboardingStep/TenantsSummaryOnboardingStep.unit.spec.ts
index 952915cf111..bcddbaa4fa6 100644
--- a/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantsSummaryOnboardingStep/TenantsSummaryOnboardingStep.unit.spec.ts
+++ b/enterprise/frontend/src/metabase-enterprise/tenants/components/TenantsSummaryOnboardingStep/TenantsSummaryOnboardingStep.unit.spec.ts
@@ -135,7 +135,7 @@ function textFromReactNode(node: ReactNode): string | null {
return node.map((n) => textFromReactNode(n) ?? "").join("");
}
- if (isValidElement(node)) {
+ if (isValidElement<{ children?: ReactNode }>(node)) {
return textFromReactNode(node.props.children) ?? "";
}
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx
index fa2d69e59ee..c5feb812894 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/BrandColorSettings/BrandColorSettings.tsx
@@ -1,5 +1,5 @@
import Color from "color";
-import { memo, useCallback, useMemo } from "react";
+import { type JSX, memo, useCallback, useMemo } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorPreview/ChartColorPreview.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorPreview/ChartColorPreview.tsx
index b5674df23a1..87e42776e1d 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorPreview/ChartColorPreview.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorPreview/ChartColorPreview.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { useDebouncedValue } from "metabase/common/hooks/use-debounced-value";
import { Box, Flex } from "metabase/ui";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx
index 0f0b871d964..d8c62d9012a 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ChartColorSettings/ChartColorSettings.tsx
@@ -1,5 +1,5 @@
import { useDisclosure } from "@mantine/hooks";
-import { memo, useCallback, useMemo } from "react";
+import { type JSX, memo, useCallback, useMemo } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.tsx
index 9853df86078..bc6cd146fdc 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ColorSettings/ColorSettings.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo, useState } from "react";
+import { type JSX, useCallback, useMemo, useState } from "react";
import { t } from "ttag";
import { SettingHeader } from "metabase/settings-components";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontFilesWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontFilesWidget.tsx
index e60039eafd9..a6f682ab15f 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontFilesWidget.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/FontWidget/FontFilesWidget.tsx
@@ -1,4 +1,4 @@
-import type { FocusEvent } from "react";
+import type { FocusEvent, JSX } from "react";
import { useCallback, useMemo } from "react";
import { t } from "ttag";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx
index 79585706254..3522c59dfe7 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/IllustrationWidget/IllustrationWidget.tsx
@@ -1,4 +1,4 @@
-import type { ChangeEvent } from "react";
+import type { ChangeEvent, JSX } from "react";
import type React from "react";
import { useEffect, useRef, useState } from "react";
import { t } from "ttag";
diff --git a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx
index f72179c0006..03d7deb7d04 100644
--- a/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx
+++ b/enterprise/frontend/src/metabase-enterprise/whitelabel/components/ImageToggle/ImageToggle.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useUniqueId } from "metabase/common/hooks/use-unique-id";
import { Box, Flex, Switch } from "metabase/ui";
diff --git a/frontend/src/embedding-sdk-bundle/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx b/frontend/src/embedding-sdk-bundle/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx
index 9f7deb79da1..1f6e3b76a4b 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/private/PublicComponentWrapper/withPublicComponentWrapper.tsx
@@ -8,7 +8,7 @@ import { PublicComponentWrapper } from "./PublicComponentWrapper";
export function withPublicComponentWrapper<P extends object>(
WrappedComponent: React.ComponentType<P>,
{ supportsGuestEmbed }: { supportsGuestEmbed: boolean },
-): (props: P) => React.ReactNode {
+): React.FC<P> {
const componentName =
WrappedComponent.displayName || WrappedComponent.name || "Component";
diff --git a/frontend/src/embedding-sdk-bundle/components/private/ResizeWrapper.tsx b/frontend/src/embedding-sdk-bundle/components/private/ResizeWrapper.tsx
index e440d9d87d4..03394606183 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/ResizeWrapper.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/private/ResizeWrapper.tsx
@@ -16,7 +16,7 @@ interface ResizeWrapperProps extends BoxProps {
/** Content to be wrapped and resized */
children: ReactNode;
/** Optional ref to attach to the inner div that receives the measured dimensions */
- ref?: RefObject<HTMLDivElement>;
+ ref?: RefObject<HTMLDivElement | null>;
}
/**
diff --git a/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.unit.spec.tsx
index 949969ed1cf..6cd962884d9 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.unit.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/private/SdkThemeProvider.unit.spec.tsx
@@ -129,12 +129,21 @@ describe("SdkThemeProvider", () => {
const DARK_OCEAN = { textHover: ocean[30], textBrand: ocean[40] };
// We need to check what was actually injected into page, thus
- // direct query (unlike other tests that use SdkCssVariablesTester)
+ // direct query (unlike other tests that use SdkCssVariablesTester).
+ // Emotion inserts rules through the CSSOM (`sheet.insertRule`), which
+ // leaves `textContent` empty, so read the applied rules off each sheet
+ // and fall back to `textContent` for any tag written as plain text.
+ const styleTagText = (element: HTMLStyleElement) => {
+ const rules = element.sheet?.cssRules;
+ if (rules && rules.length > 0) {
+ return [...rules].map((rule) => rule.cssText).join("\n");
+ }
+ return element.textContent ?? "";
+ };
+
const emittedStyles = () =>
// eslint-disable-next-line testing-library/no-node-access -- emotion writes these <style> tags; there is no Testing Library query for them
- [...document.querySelectorAll("style")]
- .map((element) => element.textContent ?? "")
- .join("\n");
+ [...document.querySelectorAll("style")].map(styleTagText).join("\n");
const setup = async (
theme: MetabaseEmbeddingTheme | undefined,
diff --git a/frontend/src/embedding-sdk-bundle/components/private/notifications/context/QuestionAlertModalProvider.tsx b/frontend/src/embedding-sdk-bundle/components/private/notifications/context/QuestionAlertModalProvider.tsx
index 04359bf243c..133b26790ad 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/notifications/context/QuestionAlertModalProvider.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/private/notifications/context/QuestionAlertModalProvider.tsx
@@ -1,5 +1,10 @@
import { useDisclosure } from "@mantine/hooks";
-import { type PropsWithChildren, createContext, useContext } from "react";
+import {
+ type JSX,
+ type PropsWithChildren,
+ createContext,
+ useContext,
+} from "react";
interface QuestionAlertModalContext {
isOpen: boolean;
diff --git a/frontend/src/embedding-sdk-bundle/components/private/util/MultiStepPopover/MultiStepPopover.tsx b/frontend/src/embedding-sdk-bundle/components/private/util/MultiStepPopover/MultiStepPopover.tsx
index 0a5a1b4558c..8fb7efb3efa 100644
--- a/frontend/src/embedding-sdk-bundle/components/private/util/MultiStepPopover/MultiStepPopover.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/private/util/MultiStepPopover/MultiStepPopover.tsx
@@ -46,12 +46,15 @@ const MultiStepPopoverContent = ({
};
const currentStepContent = findChild(
- (child): child is ReactElement<StepProps> =>
- child.type === Step && child.props.value === currentStep,
+ (child): child is ReactElement<StepProps> => {
+ // A `child.type === Step` match guarantees the element carries StepProps.
+ const props = child.props as StepProps;
+ return child.type === Step && props.value === currentStep;
+ },
)?.props.children;
const targetElement = findChild(
- (child): child is ReactElement => child.type === Target,
+ (child): child is ReactElement<PropsWithChildren> => child.type === Target,
)?.props.children;
return (
diff --git a/frontend/src/embedding-sdk-bundle/components/public/InteractiveQuestion/InteractiveQuestion.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/InteractiveQuestion/InteractiveQuestion.unit.spec.tsx
index bda8245d6d0..a9ef16ca2cc 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/InteractiveQuestion/InteractiveQuestion.unit.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/InteractiveQuestion/InteractiveQuestion.unit.spec.tsx
@@ -311,7 +311,7 @@ describe("InteractiveQuestion", () => {
});
// Both buttons are visible in view mode
- expect(screen.queryByRole("button", { name: "Alerts" })).toBeVisible();
+ expect(await screen.findByRole("button", { name: "Alerts" })).toBeVisible();
expect(
screen.queryByRole("button", { name: "Download results" }),
).toBeVisible();
diff --git a/frontend/src/embedding-sdk-bundle/components/public/MetabotQuestion/MetabotQuestion.tsx b/frontend/src/embedding-sdk-bundle/components/public/MetabotQuestion/MetabotQuestion.tsx
index 9b04a28c153..51fcea8a833 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/MetabotQuestion/MetabotQuestion.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/MetabotQuestion/MetabotQuestion.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { FC, ReactNode } from "react";
import { useTrackSdkComponentMount } from "embedding-sdk-bundle/analytics/component-events";
import type { UseMetabotResult } from "embedding-sdk-bundle/types/metabot";
@@ -6,7 +6,7 @@ import type { FunctionSchema } from "embedding-sdk-bundle/types/schema";
import type { MetabotQuestionProps } from "./types";
-type MetabotQuestionComponent = ((props: MetabotQuestionProps) => ReactNode) & {
+type MetabotQuestionComponent = FC<MetabotQuestionProps> & {
schema?: FunctionSchema;
};
diff --git a/frontend/src/embedding-sdk-bundle/components/public/SdkQuestion/SdkQuestion.tsx b/frontend/src/embedding-sdk-bundle/components/public/SdkQuestion/SdkQuestion.tsx
index dd4213ad6d3..22c783fce0b 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/SdkQuestion/SdkQuestion.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/SdkQuestion/SdkQuestion.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { withPublicComponentWrapper } from "embedding-sdk-bundle/components/private/PublicComponentWrapper";
import { SdkInternalNavigationProvider } from "embedding-sdk-bundle/components/private/SdkInternalNavigation/SdkInternalNavigationProvider";
diff --git a/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx b/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
index 691c3e0ea49..29cb5fcf32f 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/StaticQuestion/StaticQuestion.tsx
@@ -1,4 +1,4 @@
-import { type FC, type PropsWithChildren, useMemo } from "react";
+import { type FC, type JSX, type PropsWithChildren, useMemo } from "react";
import { useTrackSdkComponentMount } from "embedding-sdk-bundle/analytics/component-events";
import { FlexibleSizeComponent } from "embedding-sdk-bundle/components/private/FlexibleSizeComponent";
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/InteractiveDashboard/tests/navigated-entity-parameters.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/InteractiveDashboard/tests/navigated-entity-parameters.unit.spec.tsx
index 4a9acc00b2f..3e56ef4445f 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/InteractiveDashboard/tests/navigated-entity-parameters.unit.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/InteractiveDashboard/tests/navigated-entity-parameters.unit.spec.tsx
@@ -717,11 +717,15 @@ describe("InteractiveDashboard navigated entity parameters", () => {
await renderWithSdk(<App />);
await clickCell("Gizmo");
- await waitForTargetQueries(2);
- expect(getLastTargetQueryValues()).toEqual({
- [CATEGORY_PARAMETER.id]: ["Gizmo"],
- [VENDOR_PARAMETER.id]: ["Globex"],
- });
+ // The host applies its parameters through a state update that React may
+ // batch into the first target query, so assert on the final query
+ // values once they settle.
+ await waitFor(() =>
+ expect(getLastTargetQueryValues()).toEqual({
+ [CATEGORY_PARAMETER.id]: ["Gizmo"],
+ [VENDOR_PARAMETER.id]: ["Globex"],
+ }),
+ );
});
it("replaces the click values with its own values", async () => {
@@ -857,11 +861,15 @@ describe("InteractiveDashboard navigated entity parameters", () => {
await renderWithSdk(<App />);
await clickCell("Gizmo");
- await waitForTargetQueries(2);
- expect(getLastTargetQueryValues()).toEqual({
- [CATEGORY_PARAMETER.id]: null,
- [VENDOR_PARAMETER.id]: ["Globex"],
- });
+ // The host applies its parameters through a state update that React may
+ // batch into the first target query, so assert on the final query
+ // values once they settle.
+ await waitFor(() =>
+ expect(getLastTargetQueryValues()).toEqual({
+ [CATEGORY_PARAMETER.id]: null,
+ [VENDOR_PARAMETER.id]: ["Globex"],
+ }),
+ );
});
it("follows later changes", async () => {
diff --git a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx
index 631c65f048a..c2be1f3c23b 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/dashboard/SdkDashboard.tsx
@@ -410,7 +410,8 @@ const SdkDashboardInner = ({
: renderModeState;
// Now only used when rerendering the dashboard after creating a new question from the dashboard.
- const dashboardContextProviderRef = useRef<DashboardContextProviderHandle>();
+ const dashboardContextProviderRef =
+ useRef<DashboardContextProviderHandle>(undefined);
const [newDashboardQuestionId, setNewDashboardQuestionId] =
useState<number>();
diff --git a/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/card-prop.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/card-prop.spec.tsx
index 759ba889aac..eeba05ea5be 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/card-prop.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/card-prop.spec.tsx
@@ -28,7 +28,7 @@ import { TEST_COLUMN, TEST_DB, TEST_TABLE } from "./constants.spec";
export function addCardPropTests({
Component,
}: {
- Component: (props: { card: string | MetabaseCard }) => React.ReactNode;
+ Component: React.ComponentType<{ card: string | MetabaseCard }>;
}) {
describe("card prop", () => {
const DATASET_QUERY = {
@@ -151,7 +151,8 @@ export function addCardPropTests({
expect(screen.getByTestId("query-visualization-root")).toBeVisible();
// The `bar` visualization is honored (and locked), so a chart renders...
- expect(screen.getByTestId("chart-container")).toBeInTheDocument();
+ // React 19 paints the chart after the loader clears, so wait for it.
+ expect(await screen.findByTestId("chart-container")).toBeInTheDocument();
expect(screen.queryByTestId("table-root")).not.toBeInTheDocument();
});
});
diff --git a/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/query-prop.spec.tsx b/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/query-prop.spec.tsx
index 14396068ac4..c043be2faea 100644
--- a/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/query-prop.spec.tsx
+++ b/frontend/src/embedding-sdk-bundle/components/public/question/shared-tests/query-prop.spec.tsx
@@ -26,7 +26,7 @@ import { TEST_COLUMN, TEST_DB, TEST_TABLE } from "./constants.spec";
export function addQueryPropTests({
Component,
}: {
- Component: (props: { query: string }) => React.ReactNode;
+ Component: React.ComponentType<{ query: string }>;
}) {
describe("query prop", () => {
const QUERY_PROP = utf8_to_b64url(
diff --git a/frontend/src/embedding-sdk-bundle/hooks/private/use-load-question.ts b/frontend/src/embedding-sdk-bundle/hooks/private/use-load-question.ts
index d17c59a23b0..25e7dcea22c 100644
--- a/frontend/src/embedding-sdk-bundle/hooks/private/use-load-question.ts
+++ b/frontend/src/embedding-sdk-bundle/hooks/private/use-load-question.ts
@@ -100,7 +100,7 @@ export function useLoadQuestion({
const tokenRef = useRef(token);
tokenRef.current = token;
- const controllerRef = useRef<AbortController>();
+ const controllerRef = useRef<AbortController>(undefined);
function nextSignal() {
// Cancel the previous query when a new one is started.
diff --git a/frontend/src/embedding-sdk-bundle/test/CommonSdkCorsStoryWrapper.tsx b/frontend/src/embedding-sdk-bundle/test/CommonSdkCorsStoryWrapper.tsx
index cd7ae2809d5..21b863dd161 100644
--- a/frontend/src/embedding-sdk-bundle/test/CommonSdkCorsStoryWrapper.tsx
+++ b/frontend/src/embedding-sdk-bundle/test/CommonSdkCorsStoryWrapper.tsx
@@ -1,4 +1,4 @@
-import type { StoryFn } from "@storybook/react";
+import type { ComponentType } from "react";
// To run initialization side effects like Mantine styles, dayjs plugins, etc
import "embedding-sdk-bundle";
@@ -10,7 +10,7 @@ const DEFAULT_AUTH_CONFIG: MetabaseAuthConfig = {
metabaseInstanceUrl: STORYBOOK_METABASE_INSTANCE_URL,
};
-export const CommonSdkStoryCorsWrapper = (Story: StoryFn) => (
+export const CommonSdkStoryCorsWrapper = (Story: ComponentType) => (
<ComponentProvider authConfig={DEFAULT_AUTH_CONFIG}>
<Story />
</ComponentProvider>
diff --git a/frontend/src/embedding-sdk-bundle/test/CommonSdkStoryWrapper.tsx b/frontend/src/embedding-sdk-bundle/test/CommonSdkStoryWrapper.tsx
index 3c67cb33d6d..145a303da35 100644
--- a/frontend/src/embedding-sdk-bundle/test/CommonSdkStoryWrapper.tsx
+++ b/frontend/src/embedding-sdk-bundle/test/CommonSdkStoryWrapper.tsx
@@ -1,6 +1,5 @@
-import type { StoryFn } from "@storybook/react";
import { SignJWT } from "jose";
-import { useMemo } from "react";
+import { type ComponentType, useMemo } from "react";
// To run initialization side effects like Mantine styles, dayjs plugins, etc
import "embedding-sdk-bundle";
@@ -46,7 +45,7 @@ export const getStorybookSdkAuthConfigForUser = (
export const storybookSdkAuthDefaultConfig =
getStorybookSdkAuthConfigForUser("normal");
-export const CommonSdkStoryWrapper = (Story: StoryFn, context: any) => {
+export const CommonSdkStoryWrapper = (Story: ComponentType, context: any) => {
const sdkTheme = context.globals.sdkTheme;
const globalTheme: MetabaseTheme | undefined = sdkTheme
? storybookThemes[sdkTheme]
diff --git a/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.tsx b/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.tsx
index 62c21137106..bb25ea416bf 100644
--- a/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.tsx
+++ b/frontend/src/metabase/account/notifications/components/ArchiveModal/ArchiveModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { type JSX, useCallback, useState } from "react";
import { t } from "ttag";
import { ModalContent } from "metabase/common/components/ModalContent";
diff --git a/frontend/src/metabase/account/notifications/components/HelpModal/HelpModal.tsx b/frontend/src/metabase/account/notifications/components/HelpModal/HelpModal.tsx
index d4b3651ea06..8e4b5eebf63 100644
--- a/frontend/src/metabase/account/notifications/components/HelpModal/HelpModal.tsx
+++ b/frontend/src/metabase/account/notifications/components/HelpModal/HelpModal.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/account/notifications/components/UnsubscribeModal/UnsubscribeModal.tsx b/frontend/src/metabase/account/notifications/components/UnsubscribeModal/UnsubscribeModal.tsx
index 1ca2ddbd117..98cbc6a9107 100644
--- a/frontend/src/metabase/account/notifications/components/UnsubscribeModal/UnsubscribeModal.tsx
+++ b/frontend/src/metabase/account/notifications/components/UnsubscribeModal/UnsubscribeModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { type JSX, useCallback, useState } from "react";
import { t } from "ttag";
import { ModalContent } from "metabase/common/components/ModalContent";
diff --git a/frontend/src/metabase/account/password/components/UserPasswordForm/UserPasswordForm.tsx b/frontend/src/metabase/account/password/components/UserPasswordForm/UserPasswordForm.tsx
index 65778a08d36..91fb3ed2be4 100644
--- a/frontend/src/metabase/account/password/components/UserPasswordForm/UserPasswordForm.tsx
+++ b/frontend/src/metabase/account/password/components/UserPasswordForm/UserPasswordForm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/account/profile/components/UserProfileForm/UserProfileForm.tsx b/frontend/src/metabase/account/profile/components/UserProfileForm/UserProfileForm.tsx
index 1cbf3d7bdca..43de407f68f 100644
--- a/frontend/src/metabase/account/profile/components/UserProfileForm/UserProfileForm.tsx
+++ b/frontend/src/metabase/account/profile/components/UserProfileForm/UserProfileForm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import _ from "underscore";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx b/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx
index ba6ad8c2173..c9644981387 100644
--- a/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx
+++ b/frontend/src/metabase/actions/components/ActionForm/ActionForm.tsx
@@ -1,5 +1,5 @@
import type { FormikHelpers } from "formik";
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import useActionForm from "metabase/actions/hooks/use-action-form";
diff --git a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/DragHandle.tsx b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/DragHandle.tsx
index 14038be7028..f394a06f5ed 100644
--- a/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/DragHandle.tsx
+++ b/frontend/src/metabase/actions/containers/ActionCreator/FormCreator/FormFieldEditor/DragHandle.tsx
@@ -18,7 +18,7 @@ export const DragHandle = forwardRef<HTMLElement, DragHandleProps>(
<div
data-testid="drag-handle"
// Unjustified type cast. FIXME
- ref={ref as MutableRefObject<HTMLDivElement>}
+ ref={ref as MutableRefObject<HTMLDivElement | null>}
className={styles.dragHandle}
{...dragHandleListeners}
>
diff --git a/frontend/src/metabase/admin/ai/AISettingsPage.tsx b/frontend/src/metabase/admin/ai/AISettingsPage.tsx
index e3febb58182..5b052ca9b69 100644
--- a/frontend/src/metabase/admin/ai/AISettingsPage.tsx
+++ b/frontend/src/metabase/admin/ai/AISettingsPage.tsx
@@ -260,7 +260,7 @@ function DisabledSection({
gap="xl"
opacity={disabled ? 0.4 : 1}
aria-disabled={disabled || undefined}
- {...(disabled ? { inert: "" } : {})}
+ {...(disabled ? { inert: true } : {})}
>
{children}
</Stack>
diff --git a/frontend/src/metabase/admin/app/components/AdminApp/AdminApp.tsx b/frontend/src/metabase/admin/app/components/AdminApp/AdminApp.tsx
index 6833288cedc..7997217a4fe 100644
--- a/frontend/src/metabase/admin/app/components/AdminApp/AdminApp.tsx
+++ b/frontend/src/metabase/admin/app/components/AdminApp/AdminApp.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Outlet } from "metabase/router";
import { Box, Flex } from "metabase/ui";
diff --git a/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.tsx b/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.tsx
index 795cc99ce06..d156128933a 100644
--- a/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.tsx
+++ b/frontend/src/metabase/admin/app/components/DeprecationNotice/DeprecationNotice.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { Link } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx b/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx
index 8a76763f178..b3baf2b1676 100644
--- a/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx
+++ b/frontend/src/metabase/admin/datamodel/components/SegmentForm/SegmentForm.tsx
@@ -1,6 +1,6 @@
import type { FieldInputProps } from "formik";
import { useFormik } from "formik";
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { t } from "ttag";
import { skipToken, useGetTableQuery } from "metabase/api";
diff --git a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.unit.spec.tsx b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.unit.spec.tsx
index edb1ab9948e..0a4c64aedb7 100644
--- a/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.unit.spec.tsx
+++ b/frontend/src/metabase/admin/performance/components/StrategyEditorForDatabases.unit.spec.tsx
@@ -1,6 +1,6 @@
import userEvent from "@testing-library/user-event";
-import { screen } from "__support__/ui";
+import { screen, waitFor } from "__support__/ui";
import {
changeInput,
@@ -60,10 +60,12 @@ describe("StrategyEditorForDatabases (OSS)", () => {
await changeInput(/multiplier/i, 10, 10);
await userEvent.click(await getSaveButton());
// Re-entering the value it was saved with does not make the form dirty,
- // so the save button is not present
+ // so the save button goes away once the post-save "Saved" window elapses.
await changeInput(/multiplier/i, 10, 10);
- expect(
- screen.queryByTestId("strategy-form-submit-button"),
- ).not.toBeInTheDocument();
+ await waitFor(() => {
+ expect(
+ screen.queryByTestId("strategy-form-submit-button"),
+ ).not.toBeInTheDocument();
+ });
});
});
diff --git a/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.tsx b/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.tsx
index 890abbd064f..6db7878f019 100644
--- a/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.tsx
+++ b/frontend/src/metabase/admin/settings/auth/components/AuthCard/AuthCard.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useCallback, useState } from "react";
import { c, t } from "ttag";
diff --git a/frontend/src/metabase/admin/settings/auth/components/GoogleAuthForm/GoogleAuthForm.tsx b/frontend/src/metabase/admin/settings/auth/components/GoogleAuthForm/GoogleAuthForm.tsx
index f90b6fc5ce9..b90a658bb1e 100644
--- a/frontend/src/metabase/admin/settings/auth/components/GoogleAuthForm/GoogleAuthForm.tsx
+++ b/frontend/src/metabase/admin/settings/auth/components/GoogleAuthForm/GoogleAuthForm.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNavItem.tsx b/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNavItem.tsx
index 67e215d8241..87452c30ca6 100644
--- a/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNavItem.tsx
+++ b/frontend/src/metabase/admin/settings/components/SettingsNav/SettingsNavItem.tsx
@@ -21,8 +21,8 @@ const findBestMatchingChild = (
let bestLen = 0;
for (const child of children) {
- // Unjustified type cast. FIXME
- const childPath = child?.props?.path as string | undefined;
+ // The route children carry an optional `path` prop.
+ const childPath = (child?.props as { path?: string } | undefined)?.path;
if (!childPath) {
continue;
}
@@ -92,7 +92,8 @@ export function SettingsNavItem({
>
{children.length > 0
? children.map((child) =>
- child?.props?.path
+ // Route children carry an optional `path` prop.
+ (child?.props as { path?: string } | undefined)?.path
? // Unjustified type cast. FIXME
React.cloneElement(child, {
active: child === bestChild,
diff --git a/frontend/src/metabase/app/nav/QuestionLineage/QuestionLineage.tsx b/frontend/src/metabase/app/nav/QuestionLineage/QuestionLineage.tsx
index 28de6707002..5b0633166c3 100644
--- a/frontend/src/metabase/app/nav/QuestionLineage/QuestionLineage.tsx
+++ b/frontend/src/metabase/app/nav/QuestionLineage/QuestionLineage.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { Link } from "metabase/common/components/Link/Link";
diff --git a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx b/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
index 57cbea7bb60..c2f92f32957 100644
--- a/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
+++ b/frontend/src/metabase/auth/components/AuthLayout/AuthLayout.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { LighthouseIllustration } from "metabase/common/components/LighthouseIllustration";
import { LogoIcon } from "metabase/common/components/LogoIcon";
diff --git a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx
index 206681926f3..22a3d6f0d22 100644
--- a/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx
+++ b/frontend/src/metabase/auth/components/ForgotPassword/ForgotPassword.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { type JSX, useCallback, useState } from "react";
import { t } from "ttag";
import { Link } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
index 60351bd6b2a..b99169c80c1 100644
--- a/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
+++ b/frontend/src/metabase/auth/components/ForgotPasswordForm/ForgotPasswordForm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/auth/components/Login/Login.tsx b/frontend/src/metabase/auth/components/Login/Login.tsx
index 4902b160db6..efc001b0777 100644
--- a/frontend/src/metabase/auth/components/Login/Login.tsx
+++ b/frontend/src/metabase/auth/components/Login/Login.tsx
@@ -1,4 +1,4 @@
-import { Fragment } from "react";
+import { Fragment, type JSX } from "react";
import { useMount } from "react-use";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx b/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
index bf66c1ae067..080c71bb495 100644
--- a/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
+++ b/frontend/src/metabase/auth/components/LoginForm/LoginForm.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/auth/components/Logout/Logout.tsx b/frontend/src/metabase/auth/components/Logout/Logout.tsx
index 80b6543bb5c..d078a681115 100644
--- a/frontend/src/metabase/auth/components/Logout/Logout.tsx
+++ b/frontend/src/metabase/auth/components/Logout/Logout.tsx
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { useDispatch } from "metabase/redux";
import { logout } from "metabase/redux/auth";
diff --git a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx
index e7ccc1550d8..086ec1c9436 100644
--- a/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx
+++ b/frontend/src/metabase/auth/components/ResetPassword/ResetPassword.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { useGetPasswordResetTokenStatusQuery } from "metabase/api";
diff --git a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
index 48ab233c674..83559aa2401 100644
--- a/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
+++ b/frontend/src/metabase/auth/components/ResetPasswordForm/ResetPasswordForm.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/collections/components/CollectionContent/CollectionContentUpload.unit.spec.tsx b/frontend/src/metabase/collections/components/CollectionContent/CollectionContentUpload.unit.spec.tsx
index 22105804914..54a1407609c 100644
--- a/frontend/src/metabase/collections/components/CollectionContent/CollectionContentUpload.unit.spec.tsx
+++ b/frontend/src/metabase/collections/components/CollectionContent/CollectionContentUpload.unit.spec.tsx
@@ -77,6 +77,10 @@ async function setupCollectionContent({
schema_name: null,
table_prefix: null,
},
+ // The new-item menu loads metabot permissions in the background, and under
+ // React 19 that query resolves after the fast tests finish, tripping the
+ // act() warning guard. These tests do not exercise metabot, so keep it off.
+ "metabot-enabled?": false,
});
renderWithProviders(
diff --git a/frontend/src/metabase/collections/components/CollectionEmptyState/CollectionEmptyState.tsx b/frontend/src/metabase/collections/components/CollectionEmptyState/CollectionEmptyState.tsx
index 3b47c2e55e9..8ed74b621b6 100644
--- a/frontend/src/metabase/collections/components/CollectionEmptyState/CollectionEmptyState.tsx
+++ b/frontend/src/metabase/collections/components/CollectionEmptyState/CollectionEmptyState.tsx
@@ -1,4 +1,4 @@
-import type { PropsWithChildren } from "react";
+import type { JSX, PropsWithChildren } from "react";
import { t } from "ttag";
import EmptyStateIcon from "assets/img/empty-states/collection.svg";
diff --git a/frontend/src/metabase/collections/components/CollectionHeader/CollectionBookmark.tsx b/frontend/src/metabase/collections/components/CollectionHeader/CollectionBookmark.tsx
index cb52f66677f..c8d0f37be06 100644
--- a/frontend/src/metabase/collections/components/CollectionHeader/CollectionBookmark.tsx
+++ b/frontend/src/metabase/collections/components/CollectionHeader/CollectionBookmark.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { isRootCollection } from "metabase/common/collections/utils";
import { BookmarkToggle } from "metabase/common/components/BookmarkToggle";
diff --git a/frontend/src/metabase/collections/components/CollectionHeader/CollectionCaption.tsx b/frontend/src/metabase/collections/components/CollectionHeader/CollectionCaption.tsx
index 3a4c92ebad5..c8cc37c81da 100644
--- a/frontend/src/metabase/collections/components/CollectionHeader/CollectionCaption.tsx
+++ b/frontend/src/metabase/collections/components/CollectionHeader/CollectionCaption.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import {
diff --git a/frontend/src/metabase/collections/components/CollectionHeader/CollectionHeader.tsx b/frontend/src/metabase/collections/components/CollectionHeader/CollectionHeader.tsx
index fb923b7b296..d01ab47ad3f 100644
--- a/frontend/src/metabase/collections/components/CollectionHeader/CollectionHeader.tsx
+++ b/frontend/src/metabase/collections/components/CollectionHeader/CollectionHeader.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { useUpdateCollectionMutation } from "metabase/api";
import {
isInstanceAnalyticsCollection,
diff --git a/frontend/src/metabase/collections/components/CollectionHeader/CollectionTimeline.tsx b/frontend/src/metabase/collections/components/CollectionHeader/CollectionTimeline.tsx
index 3df0ee03e6a..505981aa315 100644
--- a/frontend/src/metabase/collections/components/CollectionHeader/CollectionTimeline.tsx
+++ b/frontend/src/metabase/collections/components/CollectionHeader/CollectionTimeline.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { Link } from "metabase/common/components/Link/Link";
diff --git a/frontend/src/metabase/collections/components/CollectionMenu/CollectionMenu.tsx b/frontend/src/metabase/collections/components/CollectionMenu/CollectionMenu.tsx
index 1767db417a3..3f007b31bf2 100644
--- a/frontend/src/metabase/collections/components/CollectionMenu/CollectionMenu.tsx
+++ b/frontend/src/metabase/collections/components/CollectionMenu/CollectionMenu.tsx
@@ -1,4 +1,4 @@
-import { type ReactNode, useState } from "react";
+import { type JSX, type ReactNode, useState } from "react";
import { t } from "ttag";
import {
diff --git a/frontend/src/metabase/collections/components/MoveCollectionModal/MoveCollectionModal.tsx b/frontend/src/metabase/collections/components/MoveCollectionModal/MoveCollectionModal.tsx
index d56ce7bcc7f..d03c3df5f3a 100644
--- a/frontend/src/metabase/collections/components/MoveCollectionModal/MoveCollectionModal.tsx
+++ b/frontend/src/metabase/collections/components/MoveCollectionModal/MoveCollectionModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { skipToken, useGetCollectionQuery } from "metabase/api";
diff --git a/frontend/src/metabase/common/components/AccordionList/AccordionList.tsx b/frontend/src/metabase/common/components/AccordionList/AccordionList.tsx
index 1febe8d3359..78d60cba8eb 100644
--- a/frontend/src/metabase/common/components/AccordionList/AccordionList.tsx
+++ b/frontend/src/metabase/common/components/AccordionList/AccordionList.tsx
@@ -61,7 +61,7 @@ export class AccordionList<
TItem extends Item,
TSection extends Section<TItem> = Section<TItem>,
> extends Component<Props<TItem, TSection>, State> {
- listRootRef: RefObject<HTMLDivElement>;
+ listRootRef: RefObject<HTMLDivElement | null>;
constructor(props: Props<TItem, TSection>, context: unknown) {
super(props, context);
diff --git a/frontend/src/metabase/common/components/CodeEditor/CodeEditor.stories.tsx b/frontend/src/metabase/common/components/CodeEditor/CodeEditor.stories.tsx
index 925a8ccddf8..4ddac951a37 100644
--- a/frontend/src/metabase/common/components/CodeEditor/CodeEditor.stories.tsx
+++ b/frontend/src/metabase/common/components/CodeEditor/CodeEditor.stories.tsx
@@ -1,3 +1,7 @@
+// @ts-expect-error There is no type definition
+import createAsyncCallback from "@loki/create-async-callback";
+import { expect, waitFor, within } from "@storybook/test";
+
import { CodeEditor } from "metabase/common/components/CodeEditor";
import { Box } from "metabase/ui";
@@ -41,4 +45,32 @@ export const Markdown = {
/>
</Box>
),
+
+ // The editor loads lazily and CodeMirror paints its content in an effect, so
+ // loki would otherwise capture the empty editor. Hold the snapshot until the
+ // content is on screen and syntax highlighting has been applied.
+ play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
+ const asyncCallback = createAsyncCallback();
+ try {
+ const canvas = within(canvasElement);
+ await waitFor(() =>
+ expect(canvas.getByText(/SQL analyst/)).toBeInTheDocument(),
+ );
+ // The document text renders a tick before CodeMirror colours its tokens,
+ // so waiting for the text alone let the burn-in catch a half-highlighted
+ // editor. Wait for the highlighted token spans too.
+ await waitFor(() =>
+ expect(
+ canvasElement.querySelectorAll(".cm-content .cm-line span").length,
+ ).toBeGreaterThan(0),
+ );
+ // A late monospace-font swap drifts the glyph metrics sub-pixel, and the
+ // drift accumulates down the document until the last line crosses the
+ // antialiasing threshold. The burn-in caught that swap mid-flight. Hold
+ // the snapshot until the fonts are ready.
+ await document.fonts.ready;
+ } finally {
+ asyncCallback();
+ }
+ },
};
diff --git a/frontend/src/metabase/common/components/CodeEditor/index.ts b/frontend/src/metabase/common/components/CodeEditor/index.ts
index 187b5a6523b..07fabd9d847 100644
--- a/frontend/src/metabase/common/components/CodeEditor/index.ts
+++ b/frontend/src/metabase/common/components/CodeEditor/index.ts
@@ -1,3 +1,3 @@
-export { CodeEditor } from "./lazy";
+export { CodeEditor, loadCodeEditor } from "./lazy";
export type { CodeEditorProps } from "./CodeEditor";
export type { CodeLanguage } from "./types";
diff --git a/frontend/src/metabase/common/components/CodeMirror/CodeMirror.tsx b/frontend/src/metabase/common/components/CodeMirror/CodeMirror.tsx
index 53e1b7dc690..40fcc47ea34 100644
--- a/frontend/src/metabase/common/components/CodeMirror/CodeMirror.tsx
+++ b/frontend/src/metabase/common/components/CodeMirror/CodeMirror.tsx
@@ -39,7 +39,7 @@ export const CodeMirror = forwardRef(function CodeMirrorInner(
tabIndex,
});
- const localRef = useRef(null);
+ const localRef = useRef<ReactCodeMirrorRef>(null);
const mergedRef = useMergedRef(localRef, ref);
useHighlightRanges(localRef, highlightRanges);
diff --git a/frontend/src/metabase/common/components/CodeMirror/highlights.ts b/frontend/src/metabase/common/components/CodeMirror/highlights.ts
index ef0eee9c77d..6f4cbcbbc43 100644
--- a/frontend/src/metabase/common/components/CodeMirror/highlights.ts
+++ b/frontend/src/metabase/common/components/CodeMirror/highlights.ts
@@ -52,7 +52,7 @@ function asRange(range: HighlightRange, view: EditorView): Range<Decoration> {
}
export function useHighlightRanges(
- editorRef: RefObject<CodeMirrorRef>,
+ editorRef: RefObject<CodeMirrorRef | null>,
highlightedRanges?: HighlightRange[],
) {
useEffect(() => {
diff --git a/frontend/src/metabase/common/components/CollapseSection/CollapseSection.tsx b/frontend/src/metabase/common/components/CollapseSection/CollapseSection.tsx
index c51326e47b8..a65615fb97b 100644
--- a/frontend/src/metabase/common/components/CollapseSection/CollapseSection.tsx
+++ b/frontend/src/metabase/common/components/CollapseSection/CollapseSection.tsx
@@ -41,7 +41,7 @@ type CollapseSectionProps = {
iconSize?: number;
onToggle?: (nextState: boolean) => void;
rightAction?: React.ReactNode;
-} & HTMLAttributes<HTMLDivElement>;
+} & Omit<HTMLAttributes<HTMLDivElement>, "onToggle">;
export const CollapseSection = ({
initialState = "collapsed",
diff --git a/frontend/src/metabase/common/components/DatabaseMultiSelect/DatabaseMultiSelect.stories.tsx b/frontend/src/metabase/common/components/DatabaseMultiSelect/DatabaseMultiSelect.stories.tsx
index b4e68856244..7334fbd855c 100644
--- a/frontend/src/metabase/common/components/DatabaseMultiSelect/DatabaseMultiSelect.stories.tsx
+++ b/frontend/src/metabase/common/components/DatabaseMultiSelect/DatabaseMultiSelect.stories.tsx
@@ -1,7 +1,6 @@
import type { Store } from "@reduxjs/toolkit";
-import type { StoryFn } from "@storybook/react";
import { HttpResponse, http } from "msw";
-import { useState } from "react";
+import { type ComponentType, useState } from "react";
import { getCommonStore } from "__support__/entities-store";
import { mockSettings } from "__support__/settings";
@@ -32,7 +31,7 @@ const storeInitialState = createMockState({
// Unjustified type cast. FIXME
const store = getCommonStore(storeInitialState) as unknown as Store<State>;
-const ReduxDecorator = (Story: StoryFn) => {
+const ReduxDecorator = (Story: ComponentType) => {
return (
<MetabaseReduxProvider store={store}>
<Story />
diff --git a/frontend/src/metabase/common/components/EditableText/EditableText.tsx b/frontend/src/metabase/common/components/EditableText/EditableText.tsx
index ac5957eee31..ed88fe482a1 100644
--- a/frontend/src/metabase/common/components/EditableText/EditableText.tsx
+++ b/frontend/src/metabase/common/components/EditableText/EditableText.tsx
@@ -4,6 +4,7 @@ import type {
FocusEvent,
FocusEventHandler,
HTMLAttributes,
+ JSX,
KeyboardEvent,
MouseEvent,
Ref,
diff --git a/frontend/src/metabase/common/components/EllipsifiedPath/EllipsifiedPath.tsx b/frontend/src/metabase/common/components/EllipsifiedPath/EllipsifiedPath.tsx
index a6bcbe5b7a5..330931d1451 100644
--- a/frontend/src/metabase/common/components/EllipsifiedPath/EllipsifiedPath.tsx
+++ b/frontend/src/metabase/common/components/EllipsifiedPath/EllipsifiedPath.tsx
@@ -32,7 +32,11 @@ export const EllipsifiedPath = ({ items, tooltip }: EllipsifiedPathProps) => {
return (
<React.Fragment key={key}>
<div
- ref={(el) => el && ref.current.set(key, el)}
+ ref={(el) => {
+ if (el) {
+ ref.current.set(key, el);
+ }
+ }}
className={S.item}
>
{item}
diff --git a/frontend/src/metabase/common/components/EmojiPicker/EmojiPicker.tsx b/frontend/src/metabase/common/components/EmojiPicker/EmojiPicker.tsx
index 243dcbf44ef..0137b58b8a5 100644
--- a/frontend/src/metabase/common/components/EmojiPicker/EmojiPicker.tsx
+++ b/frontend/src/metabase/common/components/EmojiPicker/EmojiPicker.tsx
@@ -102,7 +102,7 @@ function Emoji({
component="button"
fz="1.25rem"
// Unjustified type cast. FIXME
- ref={ref as React.RefObject<HTMLButtonElement>}
+ ref={ref as React.RefObject<HTMLButtonElement | null>}
data-emoji={emoji.emoji}
styles={{
root: {
diff --git a/frontend/src/metabase/common/components/FileInput/FileInput.tsx b/frontend/src/metabase/common/components/FileInput/FileInput.tsx
index 1a721f0c3cb..350fc5209a8 100644
--- a/frontend/src/metabase/common/components/FileInput/FileInput.tsx
+++ b/frontend/src/metabase/common/components/FileInput/FileInput.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ChangeEvent, FocusEvent, HTMLAttributes, Ref } from "react";
+import type { ChangeEvent, FocusEvent, HTMLAttributes, JSX, Ref } from "react";
import { forwardRef, useCallback, useState } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/common/components/HelpCard/HelpCard.tsx b/frontend/src/metabase/common/components/HelpCard/HelpCard.tsx
index bc6c8ec603c..4f7f6a88ae1 100644
--- a/frontend/src/metabase/common/components/HelpCard/HelpCard.tsx
+++ b/frontend/src/metabase/common/components/HelpCard/HelpCard.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import { ExternalLink } from "metabase/common/components/ExternalLink";
import { Box, Flex, Icon } from "metabase/ui";
diff --git a/frontend/src/metabase/common/components/InfoText/get-info-text.tsx b/frontend/src/metabase/common/components/InfoText/get-info-text.tsx
index 4bf0d85f87c..77e1ebb9600 100644
--- a/frontend/src/metabase/common/components/InfoText/get-info-text.tsx
+++ b/frontend/src/metabase/common/components/InfoText/get-info-text.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { getCollection } from "metabase/common/collections/utils";
diff --git a/frontend/src/metabase/common/components/ItemsTable/BaseItemsTable/BaseItemsTable.tsx b/frontend/src/metabase/common/components/ItemsTable/BaseItemsTable/BaseItemsTable.tsx
index 3b5b16b88aa..e7c9516f4bc 100644
--- a/frontend/src/metabase/common/components/ItemsTable/BaseItemsTable/BaseItemsTable.tsx
+++ b/frontend/src/metabase/common/components/ItemsTable/BaseItemsTable/BaseItemsTable.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { HTMLAttributes, PropsWithChildren } from "react";
+import type { HTMLAttributes, JSX, PropsWithChildren } from "react";
import { useMemo } from "react";
import type { CollectionContentTableColumnsMap } from "metabase/common/collections/columns";
diff --git a/frontend/src/metabase/common/components/ItemsTable/BaseItemsTableBody/SkeletonItemsTableBody.tsx b/frontend/src/metabase/common/components/ItemsTable/BaseItemsTableBody/SkeletonItemsTableBody.tsx
index f7feab3cda6..16500eaec7d 100644
--- a/frontend/src/metabase/common/components/ItemsTable/BaseItemsTableBody/SkeletonItemsTableBody.tsx
+++ b/frontend/src/metabase/common/components/ItemsTable/BaseItemsTableBody/SkeletonItemsTableBody.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import {
COLLECTION_CONTENT_COLUMNS,
type CollectionContentTableColumn,
diff --git a/frontend/src/metabase/common/components/ItemsTable/ItemsTable.tsx b/frontend/src/metabase/common/components/ItemsTable/ItemsTable.tsx
index 5b84503f26e..9dc75ae7acb 100644
--- a/frontend/src/metabase/common/components/ItemsTable/ItemsTable.tsx
+++ b/frontend/src/metabase/common/components/ItemsTable/ItemsTable.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import { t } from "ttag";
import PinDropZone from "metabase/common/collections/components/PinDropZone";
diff --git a/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx b/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx
index f65463585d3..d8ba51746d9 100644
--- a/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx
+++ b/frontend/src/metabase/common/components/LeaveConfirmModal/LeaveRouteConfirmModal.tsx
@@ -9,6 +9,7 @@ import { LeaveConfirmModal } from "./LeaveConfirmModal";
interface LeaveRouteConfirmModalProps {
isEnabled: boolean;
isLocationAllowed?: (location?: Location) => boolean;
+ isBlocking?: (location?: Location) => boolean;
onConfirm?: () => void;
onOpenChange?: (opened: boolean) => void;
}
@@ -16,12 +17,14 @@ interface LeaveRouteConfirmModalProps {
export const LeaveRouteConfirmModal = ({
isEnabled,
isLocationAllowed,
+ isBlocking,
onConfirm,
onOpenChange,
}: LeaveRouteConfirmModalProps) => {
const { opened, close, confirm } = useConfirmRouteLeaveModal({
isEnabled,
isLocationAllowed,
+ isBlocking,
});
const previousIsOpened = usePrevious(opened);
diff --git a/frontend/src/metabase/common/components/Link/Link.tsx b/frontend/src/metabase/common/components/Link/Link.tsx
index 4df320c6c16..20756f5ef08 100644
--- a/frontend/src/metabase/common/components/Link/Link.tsx
+++ b/frontend/src/metabase/common/components/Link/Link.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import type { NavLinkRenderProps } from "metabase/router";
import { Tooltip } from "metabase/ui";
diff --git a/frontend/src/metabase/common/components/Markdown/Markdown.tsx b/frontend/src/metabase/common/components/Markdown/Markdown.tsx
index 27591fb400f..ed7165b1073 100644
--- a/frontend/src/metabase/common/components/Markdown/Markdown.tsx
+++ b/frontend/src/metabase/common/components/Markdown/Markdown.tsx
@@ -3,6 +3,7 @@ import type {
AnchorHTMLAttributes,
CSSProperties,
ComponentPropsWithRef,
+ JSX,
TableHTMLAttributes,
} from "react";
import { useMemo } from "react";
diff --git a/frontend/src/metabase/common/components/MetadataInfo/TableInfo/TableInfo.tsx b/frontend/src/metabase/common/components/MetadataInfo/TableInfo/TableInfo.tsx
index d313a9d215d..25e8dd58a83 100644
--- a/frontend/src/metabase/common/components/MetadataInfo/TableInfo/TableInfo.tsx
+++ b/frontend/src/metabase/common/components/MetadataInfo/TableInfo/TableInfo.tsx
@@ -1,6 +1,6 @@
import { createSelector } from "@reduxjs/toolkit";
import cx from "classnames";
-import { useEffect, useState } from "react";
+import { type JSX, useEffect, useState } from "react";
import { useAsyncFn } from "react-use";
import { t } from "ttag";
diff --git a/frontend/src/metabase/common/components/PublicLinksListing/PublicLinksListing.unit.spec.tsx b/frontend/src/metabase/common/components/PublicLinksListing/PublicLinksListing.unit.spec.tsx
index 6da27c19a29..fc85d218f54 100644
--- a/frontend/src/metabase/common/components/PublicLinksListing/PublicLinksListing.unit.spec.tsx
+++ b/frontend/src/metabase/common/components/PublicLinksListing/PublicLinksListing.unit.spec.tsx
@@ -1,5 +1,5 @@
+import { act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { act } from "react-dom/test-utils";
import { renderWithProviders, screen, within } from "__support__/ui";
import { UndoListing } from "metabase/common/components/UndoListing";
diff --git a/frontend/src/metabase/common/components/Schedule/GroupControlsTogether.tsx b/frontend/src/metabase/common/components/Schedule/GroupControlsTogether.tsx
index f018d11cfbc..385bde46061 100644
--- a/frontend/src/metabase/common/components/Schedule/GroupControlsTogether.tsx
+++ b/frontend/src/metabase/common/components/Schedule/GroupControlsTogether.tsx
@@ -84,7 +84,9 @@ export const GroupControlsTogether = ({
);
currentGroup = [];
} else if (
- nextChild.props?.["data-group"] === GROUP_ATTRIBUTES.separate
+ // Schedule controls tag siblings with a `data-group` attribute.
+ (nextChild.props as { "data-group"?: string })?.["data-group"] ===
+ GROUP_ATTRIBUTES.separate
) {
// If the next child has a "separate" attribute, break the current group cycle
// and start a new one
diff --git a/frontend/src/metabase/common/components/Schedule/Schedule.stories.tsx b/frontend/src/metabase/common/components/Schedule/Schedule.stories.tsx
index f28e322879d..fb35733ac24 100644
--- a/frontend/src/metabase/common/components/Schedule/Schedule.stories.tsx
+++ b/frontend/src/metabase/common/components/Schedule/Schedule.stories.tsx
@@ -1,6 +1,7 @@
import type { Store } from "@reduxjs/toolkit";
import { useArgs } from "@storybook/preview-api";
import type { StoryFn } from "@storybook/react";
+import type { ComponentType } from "react";
import { t } from "ttag";
import { getPublicStore } from "__support__/entities-store";
@@ -22,7 +23,7 @@ const storeInitialState = createMockState({
// Unjustified type cast. FIXME
const store = getPublicStore(storeInitialState) as unknown as Store<State>;
-const ReduxDecorator = (Story: StoryFn) => {
+const ReduxDecorator = (Story: ComponentType) => {
return (
<MetabaseReduxProvider store={store}>
<Story />
diff --git a/frontend/src/metabase/common/components/Schedule/Schedule.tsx b/frontend/src/metabase/common/components/Schedule/Schedule.tsx
index 5b7a9476b94..0b637c7c1cd 100644
--- a/frontend/src/metabase/common/components/Schedule/Schedule.tsx
+++ b/frontend/src/metabase/common/components/Schedule/Schedule.tsx
@@ -1,5 +1,11 @@
import cx from "classnames";
-import { type HTMLAttributes, useCallback, useMemo, useState } from "react";
+import {
+ type HTMLAttributes,
+ type JSX,
+ useCallback,
+ useMemo,
+ useState,
+} from "react";
import { match } from "ts-pattern";
import { c } from "ttag";
diff --git a/frontend/src/metabase/common/components/SearchResultLink/SearchResultLink.tsx b/frontend/src/metabase/common/components/SearchResultLink/SearchResultLink.tsx
index 51b80cf3cc0..3378ead4688 100644
--- a/frontend/src/metabase/common/components/SearchResultLink/SearchResultLink.tsx
+++ b/frontend/src/metabase/common/components/SearchResultLink/SearchResultLink.tsx
@@ -1,4 +1,4 @@
-import type { MouseEvent } from "react";
+import type { JSX, MouseEvent } from "react";
import { Anchor, Group, Text, Tooltip } from "metabase/ui";
import { useIsTruncated } from "metabase/ui/hooks/use-is-truncated";
diff --git a/frontend/src/metabase/common/components/SendTestPulse/SendTestPulse.tsx b/frontend/src/metabase/common/components/SendTestPulse/SendTestPulse.tsx
index 45cf10de0ad..2c6ed1f86a2 100644
--- a/frontend/src/metabase/common/components/SendTestPulse/SendTestPulse.tsx
+++ b/frontend/src/metabase/common/components/SendTestPulse/SendTestPulse.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { ActionButton } from "metabase/common/components/ActionButton";
diff --git a/frontend/src/metabase/common/components/Sortable/SortableList.tsx b/frontend/src/metabase/common/components/Sortable/SortableList.tsx
index a5fa5066133..5a553678b14 100644
--- a/frontend/src/metabase/common/components/Sortable/SortableList.tsx
+++ b/frontend/src/metabase/common/components/Sortable/SortableList.tsx
@@ -6,7 +6,7 @@ import type {
} from "@dnd-kit/core";
import { DndContext, DragOverlay } from "@dnd-kit/core";
import { SortableContext, arrayMove } from "@dnd-kit/sortable";
-import React, { useLayoutEffect, useMemo, useState } from "react";
+import React, { type JSX, useLayoutEffect, useMemo, useState } from "react";
import { createPortal } from "react-dom";
import _ from "underscore";
diff --git a/frontend/src/metabase/common/components/Toaster/Toaster.tsx b/frontend/src/metabase/common/components/Toaster/Toaster.tsx
index 1792aacfc95..2d1795f8bd3 100644
--- a/frontend/src/metabase/common/components/Toaster/Toaster.tsx
+++ b/frontend/src/metabase/common/components/Toaster/Toaster.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { HTMLAttributes, ReactNode } from "react";
+import type { HTMLAttributes, JSX, ReactNode } from "react";
import { useEffect, useState } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/common/components/UndoListing.tsx b/frontend/src/metabase/common/components/UndoListing.tsx
index 1202795e477..8a8f0cae8de 100644
--- a/frontend/src/metabase/common/components/UndoListing.tsx
+++ b/frontend/src/metabase/common/components/UndoListing.tsx
@@ -1,5 +1,6 @@
import {
type CSSProperties,
+ type ComponentProps,
type FocusEvent,
Fragment,
type ReactNode,
@@ -271,7 +272,7 @@ document.body.appendChild(target);
// so disable them for altogether.
const Group = "Cypress" in window ? MockGroup : TransitionGroup;
-function MockGroup({ children }: { children: ReactNode }) {
+function MockGroup({ children }: ComponentProps<typeof TransitionGroup>) {
return <Fragment>{children}</Fragment>;
}
diff --git a/frontend/src/metabase/common/components/UndoListing.unit.spec.tsx b/frontend/src/metabase/common/components/UndoListing.unit.spec.tsx
index ea42dbcfa59..1c9ecc42bb2 100644
--- a/frontend/src/metabase/common/components/UndoListing.unit.spec.tsx
+++ b/frontend/src/metabase/common/components/UndoListing.unit.spec.tsx
@@ -1,5 +1,6 @@
import type { Store } from "@reduxjs/toolkit";
import userEvent from "@testing-library/user-event";
+import { createRef } from "react";
import { act, renderWithProviders, screen, waitFor } from "__support__/ui";
import type { State } from "metabase/redux/store";
@@ -311,6 +312,9 @@ function makeUndo(override: UndoOverride = {}): Undo {
canDismiss: true,
id,
_domId: id,
+ // Matches the ref the addUndo reducer assigns. react-transition-group needs
+ // a nodeRef under React 19, which removed the findDOMNode fallback.
+ ref: createRef(),
...override,
};
}
diff --git a/frontend/src/metabase/common/components/Unsubscribe.tsx b/frontend/src/metabase/common/components/Unsubscribe.tsx
index ebf3ef85413..370e127c770 100644
--- a/frontend/src/metabase/common/components/Unsubscribe.tsx
+++ b/frontend/src/metabase/common/components/Unsubscribe.tsx
@@ -1,4 +1,4 @@
-import { useMemo, useState } from "react";
+import { type JSX, useMemo, useState } from "react";
import { useAsync } from "react-use";
import { jt, t } from "ttag";
diff --git a/frontend/src/metabase/common/components/UserHasSeen/UserHasSeenAll.tsx b/frontend/src/metabase/common/components/UserHasSeen/UserHasSeenAll.tsx
index 641fffd4d1e..7fdff26b72d 100644
--- a/frontend/src/metabase/common/components/UserHasSeen/UserHasSeenAll.tsx
+++ b/frontend/src/metabase/common/components/UserHasSeen/UserHasSeenAll.tsx
@@ -1,4 +1,4 @@
-import { useContext } from "react";
+import { type JSX, useContext } from "react";
import {
UserHasSeenAllContext,
diff --git a/frontend/src/metabase/common/hooks/use-action-button-label/use-action-button-label.ts b/frontend/src/metabase/common/hooks/use-action-button-label/use-action-button-label.ts
index 177ea8f86d3..31366eceda6 100644
--- a/frontend/src/metabase/common/hooks/use-action-button-label/use-action-button-label.ts
+++ b/frontend/src/metabase/common/hooks/use-action-button-label/use-action-button-label.ts
@@ -15,7 +15,7 @@ export const useActionButtonLabel = ({
timeout = 3000,
}: UseActionButtonLabelProps) => {
const [label, setLabel] = useState(defaultLabel);
- const timeoutId = useRef<number>();
+ const timeoutId = useRef<number>(undefined);
const handleUpdateLabel = (newLabel: string) => {
clearTimeout(timeoutId.current);
diff --git a/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts b/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts
index 691766ef8e8..815661ee5d3 100644
--- a/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts
+++ b/frontend/src/metabase/common/hooks/use-confirm-route-leave-modal.ts
@@ -7,6 +7,13 @@ import { useBeforeUnload } from "./use-before-unload";
interface UseConfirmLeaveModalInput {
isEnabled: boolean;
isLocationAllowed?: (location: Location | undefined) => boolean;
+ // Decides blocking at navigation time, overriding the `isEnabled` +
+ // `isLocationAllowed` pair for the blocker (but not for `useBeforeUnload`).
+ // The pair is captured per render, so under React 19 a navigation can run
+ // against a render that has not committed the latest dirty state yet and slip
+ // through unblocked (metabase#76382). A caller that reads its dirty state from
+ // a live source (the redux store) at call time is immune to that race.
+ isBlocking?: (location: Location | undefined) => boolean;
}
interface UseConfirmLeaveModalResult {
@@ -30,11 +37,14 @@ const BLOCK_EVERY_LOCATION = () => false;
export const useConfirmRouteLeaveModal = ({
isEnabled,
isLocationAllowed = BLOCK_EVERY_LOCATION,
+ isBlocking,
}: UseConfirmLeaveModalInput): UseConfirmLeaveModalResult => {
useBeforeUnload(isEnabled);
- const blocker = useRouteLeaveBlocker(
- ({ nextLocation }) => isEnabled && !isLocationAllowed(nextLocation),
+ const blocker = useRouteLeaveBlocker(({ nextLocation }) =>
+ isBlocking
+ ? isBlocking(nextLocation)
+ : isEnabled && !isLocationAllowed(nextLocation),
);
// The blocker holds the attempted navigation, so confirming resumes it and
diff --git a/frontend/src/metabase/common/hooks/use-on-click-outside.ts b/frontend/src/metabase/common/hooks/use-on-click-outside.ts
index 066178fc546..8d8203046f6 100644
--- a/frontend/src/metabase/common/hooks/use-on-click-outside.ts
+++ b/frontend/src/metabase/common/hooks/use-on-click-outside.ts
@@ -6,7 +6,7 @@ interface ValidRefTarget {
}
export function useOnClickOutside<T extends ValidRefTarget = HTMLDivElement>(
- ref: RefObject<T>,
+ ref: RefObject<T | null>,
callback: () => void,
) {
useEffect(() => {
diff --git a/frontend/src/metabase/common/hooks/use-scroll-to-top.ts b/frontend/src/metabase/common/hooks/use-scroll-to-top.ts
index cacbfa4c29d..92d24e7021c 100644
--- a/frontend/src/metabase/common/hooks/use-scroll-to-top.ts
+++ b/frontend/src/metabase/common/hooks/use-scroll-to-top.ts
@@ -2,7 +2,7 @@ import { type RefObject, useLayoutEffect, useRef } from "react";
import _ from "underscore";
type UseScrollToTopProps = {
- ref: RefObject<HTMLElement>;
+ ref: RefObject<HTMLElement | null>;
keys: unknown[];
skip?: boolean;
};
diff --git a/frontend/src/metabase/common/hooks/use-scroll-to-top.unit.spec.tsx b/frontend/src/metabase/common/hooks/use-scroll-to-top.unit.spec.tsx
index 3a44e7461f2..d41f86dbad2 100644
--- a/frontend/src/metabase/common/hooks/use-scroll-to-top.unit.spec.tsx
+++ b/frontend/src/metabase/common/hooks/use-scroll-to-top.unit.spec.tsx
@@ -10,7 +10,7 @@ type Props = {
function setup(initialProps: Props) {
const element = document.createElement("div");
- const ref: RefObject<HTMLElement> = { current: element };
+ const ref: RefObject<HTMLElement | null> = { current: element };
element.scrollTop = 100;
const view = renderHook(
diff --git a/frontend/src/metabase/common/hooks/use-temporary-state.ts b/frontend/src/metabase/common/hooks/use-temporary-state.ts
index 922f6b3b9a7..199a744655a 100644
--- a/frontend/src/metabase/common/hooks/use-temporary-state.ts
+++ b/frontend/src/metabase/common/hooks/use-temporary-state.ts
@@ -13,7 +13,7 @@ export function useTemporaryState<T>(
ms: number,
): [T, (newValue: T) => void] {
const [value, setValue] = useState(baseValue);
- const timeoutIdRef = useRef<number>();
+ const timeoutIdRef = useRef<number>(undefined);
const changeValue = useCallback(
(newValue: T) => {
diff --git a/frontend/src/metabase/dashboard/components/DashCard/use-auto-scroll-into-view.ts b/frontend/src/metabase/dashboard/components/DashCard/use-auto-scroll-into-view.ts
index dd10f08dcde..53995378b77 100644
--- a/frontend/src/metabase/dashboard/components/DashCard/use-auto-scroll-into-view.ts
+++ b/frontend/src/metabase/dashboard/components/DashCard/use-auto-scroll-into-view.ts
@@ -27,14 +27,14 @@ export function useAutoScrollIntoView({
enabled,
onScrolled,
}: {
- ref: RefObject<HTMLElement>;
+ ref: RefObject<HTMLElement | null>;
enabled: boolean;
onScrolled: () => void;
}) {
const onScrolledRef = useRef(onScrolled);
onScrolledRef.current = onScrolled;
- const frameRef = useRef<number>();
+ const frameRef = useRef<number>(undefined);
useEffect(() => () => cancelAnimationFrame(frameRef.current ?? 0), []);
diff --git a/frontend/src/metabase/dashboard/components/DashboardBookmark.tsx b/frontend/src/metabase/dashboard/components/DashboardBookmark.tsx
index 5ceaab26958..69e49ffcdb5 100644
--- a/frontend/src/metabase/dashboard/components/DashboardBookmark.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardBookmark.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import {
useCreateBookmarkMutation,
useDeleteBookmarkMutation,
diff --git a/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx b/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
index f000c5287ce..c1bccd1e25b 100644
--- a/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
+++ b/frontend/src/metabase/dashboard/components/DashboardInfoSidebar/DashboardPublicLinkPopover/DashboardPublicLinkPopover.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import {
useCreateDashboardPublicLinkMutation,
useDeleteDashboardPublicLinkMutation,
diff --git a/frontend/src/metabase/dashboard/components/ParameterSettings/ParameterSettings.tsx b/frontend/src/metabase/dashboard/components/ParameterSettings/ParameterSettings.tsx
index 0b7d9a708f6..294b89ff57f 100644
--- a/frontend/src/metabase/dashboard/components/ParameterSettings/ParameterSettings.tsx
+++ b/frontend/src/metabase/dashboard/components/ParameterSettings/ParameterSettings.tsx
@@ -1,4 +1,5 @@
import {
+ type JSX,
type ReactNode,
useCallback,
useLayoutEffect,
diff --git a/frontend/src/metabase/dashboard/components/ParameterSidebar/ParameterSidebar.tsx b/frontend/src/metabase/dashboard/components/ParameterSidebar/ParameterSidebar.tsx
index 8825ad18258..ff0a0f17ee7 100644
--- a/frontend/src/metabase/dashboard/components/ParameterSidebar/ParameterSidebar.tsx
+++ b/frontend/src/metabase/dashboard/components/ParameterSidebar/ParameterSidebar.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { type JSX, useCallback, useEffect, useMemo, useState } from "react";
import { usePrevious } from "react-use";
import { c, msgid, t } from "ttag";
diff --git a/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.ts b/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.ts
index 96c874f1877..eaa127095bb 100644
--- a/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.ts
+++ b/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.ts
@@ -4,7 +4,7 @@ export function useIsParameterPanelSticky({
parameterPanelRef,
disabled = false,
}: {
- parameterPanelRef: RefObject<HTMLElement>;
+ parameterPanelRef: RefObject<HTMLElement | null>;
disabled?: boolean;
}) {
const [isSticky, setIsSticky] = useState(false);
diff --git a/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.unit.spec.tsx b/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.unit.spec.tsx
index c3db37f4ea5..e2500dc6228 100644
--- a/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/hooks/use-is-parameter-panel-sticky.unit.spec.tsx
@@ -3,7 +3,7 @@ import { act, renderHook, waitFor } from "@testing-library/react";
import { useIsParameterPanelSticky } from "./use-is-parameter-panel-sticky";
const setup = () => {
- const parameterPanelRef: React.RefObject<HTMLDivElement> = {
+ const parameterPanelRef: React.RefObject<HTMLDivElement | null> = {
current: document.createElement("div"),
};
const { result, unmount } = renderHook(() =>
diff --git a/frontend/src/metabase/dashboard/visualizations/Heading/Heading.tsx b/frontend/src/metabase/dashboard/visualizations/Heading/Heading.tsx
index 130d08798c6..80a5236374e 100644
--- a/frontend/src/metabase/dashboard/visualizations/Heading/Heading.tsx
+++ b/frontend/src/metabase/dashboard/visualizations/Heading/Heading.tsx
@@ -1,5 +1,5 @@
import { useDisclosure } from "@mantine/hooks";
-import type { MouseEvent } from "react";
+import type { JSX, MouseEvent } from "react";
import { useEffect, useMemo, useState } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/dashboard/visualizations/Text/Text.unit.spec.tsx b/frontend/src/metabase/dashboard/visualizations/Text/Text.unit.spec.tsx
index 6a9bcef4882..01ce8af8542 100644
--- a/frontend/src/metabase/dashboard/visualizations/Text/Text.unit.spec.tsx
+++ b/frontend/src/metabase/dashboard/visualizations/Text/Text.unit.spec.tsx
@@ -124,7 +124,9 @@ describe("Text", () => {
const img = screen.getByRole("img", { name: "alt" });
expect(img).toBeInTheDocument();
- expect(img).toHaveAttribute("src", "");
+ // The unsafe data URI is stripped, so the image has no source. React 19
+ // drops an empty `src` attribute rather than rendering `src=""`.
+ expect(img).not.toHaveAttribute("src");
});
});
diff --git a/frontend/src/metabase/data-grid/hooks/use-cell-selection.tsx b/frontend/src/metabase/data-grid/hooks/use-cell-selection.tsx
index 918aa7f54c7..52d8ffd5cd8 100644
--- a/frontend/src/metabase/data-grid/hooks/use-cell-selection.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-cell-selection.tsx
@@ -27,7 +27,7 @@ interface UseCellSelectionProps {
/** Table instance from TanStack Table */
table: Table<any>;
/** Ref to the grid element */
- gridRef: RefObject<HTMLDivElement>;
+ gridRef: RefObject<HTMLDivElement | null>;
/** Whether cell selection is enabled */
isEnabled?: boolean;
/** Optional function to scroll to a specific cell */
@@ -512,7 +512,7 @@ const extractCellValue = (
* @returns Tab-separated values with newlines between rows
*/
const getCellValues = (
- gridRef: RefObject<HTMLDivElement>,
+ gridRef: RefObject<HTMLDivElement | null>,
table: Table<unknown>,
cells: CellId[],
useRawValues = false,
diff --git a/frontend/src/metabase/data-grid/hooks/use-column-pinning-by-count.ts b/frontend/src/metabase/data-grid/hooks/use-column-pinning-by-count.ts
index 8471af44150..5c8746dfb02 100644
--- a/frontend/src/metabase/data-grid/hooks/use-column-pinning-by-count.ts
+++ b/frontend/src/metabase/data-grid/hooks/use-column-pinning-by-count.ts
@@ -7,7 +7,7 @@ import { type RefObject, useMemo, useState } from "react";
import { countWithinLimit } from "../utils/count-within-limit";
type UseColumnPinningByCountProps = {
- gridRef: RefObject<HTMLDivElement>;
+ gridRef: RefObject<HTMLDivElement | null>;
pinnedColumnsCount: number;
columnSizingMap: ColumnSizingState;
columnOrder: string[];
diff --git a/frontend/src/metabase/data-grid/hooks/use-column-resize-observer.tsx b/frontend/src/metabase/data-grid/hooks/use-column-resize-observer.tsx
index ec8a7551db0..16cc90c24dc 100644
--- a/frontend/src/metabase/data-grid/hooks/use-column-resize-observer.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-column-resize-observer.tsx
@@ -5,7 +5,7 @@ export const useColumnResizeObserver = (
state: TableState,
onChange: (columnId: string, columnSize: number) => void,
) => {
- const columnResizeRef = useRef<string | false>();
+ const columnResizeRef = useRef<string | false>(undefined);
useEffect(() => {
if (
state.columnSizingInfo &&
diff --git a/frontend/src/metabase/data-grid/hooks/use-columns-reordering.tsx b/frontend/src/metabase/data-grid/hooks/use-columns-reordering.tsx
index 78076920e49..cf9fcab6e42 100644
--- a/frontend/src/metabase/data-grid/hooks/use-columns-reordering.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-columns-reordering.tsx
@@ -26,7 +26,7 @@ export type ColumnsReordering = {
export const useColumnsReordering = <TData,>(
table: ReactTable<TData>,
- gridRef: React.RefObject<HTMLDivElement>,
+ gridRef: React.RefObject<HTMLDivElement | null>,
onColumnReorder?: (columnNames: string[]) => void,
): ColumnsReordering => {
const prevOrder = useRef<string[] | null>(null);
diff --git a/frontend/src/metabase/data-grid/hooks/use-data-grid-instance.tsx b/frontend/src/metabase/data-grid/hooks/use-data-grid-instance.tsx
index 7604b61e210..79fac14857f 100644
--- a/frontend/src/metabase/data-grid/hooks/use-data-grid-instance.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-data-grid-instance.tsx
@@ -385,8 +385,8 @@ export const useDataGridInstance = <TData, TValue>({
}, [sorting, data, table]);
const { measureGrid, columnVirtualizer } = virtualGrid;
- const prevColumnSizing = useRef<ColumnSizingState>();
- const prevWrappedColumns = useRef<string[]>();
+ const prevColumnSizing = useRef<ColumnSizingState>(undefined);
+ const prevWrappedColumns = useRef<string[]>(undefined);
useEffect(() => {
const didColumnSizingChange =
diff --git a/frontend/src/metabase/data-grid/hooks/use-expand-columns-to-min-grid-width.tsx b/frontend/src/metabase/data-grid/hooks/use-expand-columns-to-min-grid-width.tsx
index 90f945c7c31..3a9b3920c19 100644
--- a/frontend/src/metabase/data-grid/hooks/use-expand-columns-to-min-grid-width.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-expand-columns-to-min-grid-width.tsx
@@ -33,7 +33,7 @@ export const useExpandColumnsToMinGridWidth = ({
}: useExpandColumnsToMinGridWidthProps) => {
const prevMinGridWidth = usePrevious(minGridWidth);
// Store original column widths before any expansion
- const preExpandedColumnWidths = useRef<ColumnSizingState>();
+ const preExpandedColumnWidths = useRef<ColumnSizingState>(undefined);
/**
* Expands column widths while respecting fixed-width columns
diff --git a/frontend/src/metabase/data-grid/hooks/use-virtual-grid.tsx b/frontend/src/metabase/data-grid/hooks/use-virtual-grid.tsx
index b6c3ab326e0..b89bdb9f0b8 100644
--- a/frontend/src/metabase/data-grid/hooks/use-virtual-grid.tsx
+++ b/frontend/src/metabase/data-grid/hooks/use-virtual-grid.tsx
@@ -8,7 +8,7 @@ import type React from "react";
import { useCallback, useMemo } from "react";
interface VirtualGridProps<TData> {
- gridRef: React.RefObject<HTMLDivElement>;
+ gridRef: React.RefObject<HTMLDivElement | null>;
table: ReactTable<TData>;
defaultRowHeight: number;
enableRowVirtualization?: boolean;
diff --git a/frontend/src/metabase/data-grid/types.ts b/frontend/src/metabase/data-grid/types.ts
index b94a2ad9194..8f7f9d74e44 100644
--- a/frontend/src/metabase/data-grid/types.ts
+++ b/frontend/src/metabase/data-grid/types.ts
@@ -323,7 +323,7 @@ export type ScrollToDestinations = {
export interface DataGridInstance<TData> {
table: Table<TData>;
- gridRef: RefObject<HTMLDivElement>;
+ gridRef: RefObject<HTMLDivElement | null>;
virtualGrid: VirtualGrid;
measureRoot: React.ReactNode;
columnsReordering: ColumnsReordering;
diff --git a/frontend/src/metabase/databases/components/DatabaseAuthCodeDescription/DatabaseAuthCodeDescription.tsx b/frontend/src/metabase/databases/components/DatabaseAuthCodeDescription/DatabaseAuthCodeDescription.tsx
index 73927f637bb..4fc6bfc529d 100644
--- a/frontend/src/metabase/databases/components/DatabaseAuthCodeDescription/DatabaseAuthCodeDescription.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseAuthCodeDescription/DatabaseAuthCodeDescription.tsx
@@ -1,4 +1,5 @@
import { useFormikContext } from "formik";
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/databases/components/DatabaseAuthProviderSectionField/DatabaseAuthProviderSectionField.tsx b/frontend/src/metabase/databases/components/DatabaseAuthProviderSectionField/DatabaseAuthProviderSectionField.tsx
index 39b9fa7c021..d12c1c9365d 100644
--- a/frontend/src/metabase/databases/components/DatabaseAuthProviderSectionField/DatabaseAuthProviderSectionField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseAuthProviderSectionField/DatabaseAuthProviderSectionField.tsx
@@ -1,5 +1,5 @@
import { useField } from "formik";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { FormField } from "metabase/forms";
diff --git a/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx b/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx
index 7f41778f876..78bf45f973f 100644
--- a/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseCacheScheduleField/DatabaseCacheScheduleField.tsx
@@ -1,5 +1,5 @@
import { useField, useFormikContext } from "formik";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useCallback } from "react";
import { match } from "ts-pattern";
import { t } from "ttag";
diff --git a/frontend/src/metabase/databases/components/DatabaseClientIdDescription/DatabaseClientIdDescription.tsx b/frontend/src/metabase/databases/components/DatabaseClientIdDescription/DatabaseClientIdDescription.tsx
index 712d640b8b2..74cff2bb7e0 100644
--- a/frontend/src/metabase/databases/components/DatabaseClientIdDescription/DatabaseClientIdDescription.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseClientIdDescription/DatabaseClientIdDescription.tsx
@@ -1,4 +1,5 @@
import { useFormikContext } from "formik";
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/databases/components/DatabaseConnectionSectionField/DatabaseConnectionSectionField.tsx b/frontend/src/metabase/databases/components/DatabaseConnectionSectionField/DatabaseConnectionSectionField.tsx
index d9f023535ba..93d740c9094 100644
--- a/frontend/src/metabase/databases/components/DatabaseConnectionSectionField/DatabaseConnectionSectionField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseConnectionSectionField/DatabaseConnectionSectionField.tsx
@@ -1,5 +1,5 @@
import { useField } from "formik";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { FormField } from "metabase/forms";
diff --git a/frontend/src/metabase/databases/components/DatabaseDetailField.tsx b/frontend/src/metabase/databases/components/DatabaseDetailField.tsx
index 9d0302b35a9..879f77183c7 100644
--- a/frontend/src/metabase/databases/components/DatabaseDetailField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseDetailField.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { FormFileInput } from "metabase/common/components/FormFileInput";
import {
FormNumberInput,
diff --git a/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineField.tsx b/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineField.tsx
index 92d7b4b9658..95c93ecab0c 100644
--- a/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineField.tsx
@@ -1,5 +1,5 @@
import { useFormikContext } from "formik";
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import type { DatabaseData, Engine } from "metabase-types/api";
diff --git a/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineSelect.tsx b/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineSelect.tsx
index fff8f41add4..ddc3ed60229 100644
--- a/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineSelect.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseEngineField/DatabaseEngineSelect.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { getEngineLogo } from "metabase/databases/utils/engine";
diff --git a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx b/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
index f3ad2ece3a4..e10573aa481 100644
--- a/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseEngineWarning/DatabaseEngineWarning.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { jt, t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/databases/components/DatabaseForm/DatabaseForm.tsx b/frontend/src/metabase/databases/components/DatabaseForm/DatabaseForm.tsx
index 6c04715957a..f04eb7ae889 100644
--- a/frontend/src/metabase/databases/components/DatabaseForm/DatabaseForm.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseForm/DatabaseForm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { useListEnginesQuery } from "metabase/api";
import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";
diff --git a/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx b/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx
index 647b685bce6..f7ba61e74e1 100644
--- a/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseForm/tests/test-connection.unit.spec.tsx
@@ -152,7 +152,9 @@ describe("DatabaseForm > test connection", () => {
expect(
await screen.findByLabelText("Connection successful"),
).toBeInTheDocument();
- expect(getTestConnectionButton()).not.toHaveAttribute("data-loading");
+ await waitFor(() =>
+ expect(getTestConnectionButton()).not.toHaveAttribute("data-loading"),
+ );
expect(await findValidateRequests()).toHaveLength(1);
});
});
diff --git a/frontend/src/metabase/databases/components/DatabaseHelpCard/DatabaseHelpCard.tsx b/frontend/src/metabase/databases/components/DatabaseHelpCard/DatabaseHelpCard.tsx
index 2bf32d38fee..f8ac6e8c651 100644
--- a/frontend/src/metabase/databases/components/DatabaseHelpCard/DatabaseHelpCard.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseHelpCard/DatabaseHelpCard.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.tsx b/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.tsx
index f2dde339c4f..4042f3b9172 100644
--- a/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.tsx
@@ -1,5 +1,5 @@
import { useField } from "formik";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { FormField } from "metabase/forms";
diff --git a/frontend/src/metabase/databases/components/DatabaseInfoField/DatabaseInfoField.tsx b/frontend/src/metabase/databases/components/DatabaseInfoField/DatabaseInfoField.tsx
index 40cd81fa711..cab9c17c750 100644
--- a/frontend/src/metabase/databases/components/DatabaseInfoField/DatabaseInfoField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseInfoField/DatabaseInfoField.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Markdown } from "metabase/common/components/Markdown";
import { Flex } from "metabase/ui";
diff --git a/frontend/src/metabase/databases/components/DatabaseNameField/DatabaseNameField.tsx b/frontend/src/metabase/databases/components/DatabaseNameField/DatabaseNameField.tsx
index d4f56bd4084..4182e56f971 100644
--- a/frontend/src/metabase/databases/components/DatabaseNameField/DatabaseNameField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseNameField/DatabaseNameField.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import type { DatabaseFormConfig } from "metabase/databases/types";
diff --git a/frontend/src/metabase/databases/components/DatabaseScheduleToggleField/DatabaseScheduleToggleField.tsx b/frontend/src/metabase/databases/components/DatabaseScheduleToggleField/DatabaseScheduleToggleField.tsx
index e0955d71f9c..76fbf77cf8e 100644
--- a/frontend/src/metabase/databases/components/DatabaseScheduleToggleField/DatabaseScheduleToggleField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseScheduleToggleField/DatabaseScheduleToggleField.tsx
@@ -1,5 +1,5 @@
import { useFormikContext } from "formik";
-import type { ChangeEvent, ReactNode } from "react";
+import type { ChangeEvent, JSX, ReactNode } from "react";
import { useCallback } from "react";
import { FormSwitch } from "metabase/forms";
diff --git a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
index 85cb72d69d0..c86c999dc38 100644
--- a/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseSectionField/DatabaseSectionField.tsx
@@ -1,5 +1,5 @@
import { useField } from "formik";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { Box, Button, Icon } from "metabase/ui";
diff --git a/frontend/src/metabase/databases/components/DatabaseSshDescription/DatabaseSshDescription.tsx b/frontend/src/metabase/databases/components/DatabaseSshDescription/DatabaseSshDescription.tsx
index f1c7a9751f6..468dfad61b3 100644
--- a/frontend/src/metabase/databases/components/DatabaseSshDescription/DatabaseSshDescription.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseSshDescription/DatabaseSshDescription.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/databases/components/DatabaseSslKeyDescription/DatabaseSslKeyDescription.tsx b/frontend/src/metabase/databases/components/DatabaseSslKeyDescription/DatabaseSslKeyDescription.tsx
index 428170cd3e3..0aa3b0cb9f1 100644
--- a/frontend/src/metabase/databases/components/DatabaseSslKeyDescription/DatabaseSslKeyDescription.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseSslKeyDescription/DatabaseSslKeyDescription.tsx
@@ -1,4 +1,5 @@
import { useFormikContext } from "formik";
+import type { JSX } from "react";
import { jt, t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx b/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx
index 08907517c5b..2f65edce69a 100644
--- a/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx
+++ b/frontend/src/metabase/databases/components/DatabaseSyncScheduleField/DatabaseSyncScheduleField.tsx
@@ -1,5 +1,5 @@
import { useField } from "formik";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useCallback } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/detail-view/components/Relationships/Relationships.tsx b/frontend/src/metabase/detail-view/components/Relationships/Relationships.tsx
index aa96a8516dd..09018a8ec5f 100644
--- a/frontend/src/metabase/detail-view/components/Relationships/Relationships.tsx
+++ b/frontend/src/metabase/detail-view/components/Relationships/Relationships.tsx
@@ -1,4 +1,4 @@
-import { type ReactNode, useMemo } from "react";
+import { type JSX, type ReactNode, useMemo } from "react";
import { jt, t } from "ttag";
import { type BoxProps, Stack, Text } from "metabase/ui";
diff --git a/frontend/src/metabase/documents/components/Editor/Editor.stories.tsx b/frontend/src/metabase/documents/components/Editor/Editor.stories.tsx
index 48e0d3c3780..af78bf7bd90 100644
--- a/frontend/src/metabase/documents/components/Editor/Editor.stories.tsx
+++ b/frontend/src/metabase/documents/components/Editor/Editor.stories.tsx
@@ -1,6 +1,6 @@
import type { Store } from "@reduxjs/toolkit";
-import type { StoryFn } from "@storybook/react";
import { HttpResponse, http } from "msw";
+import type { ComponentType } from "react";
import { getCommonStore } from "__support__/entities-store";
import { mockSettings } from "__support__/settings";
@@ -38,7 +38,7 @@ const storeInitialState = createMockState({
// Unjustified type cast. FIXME
const store = getCommonStore(storeInitialState) as unknown as Store<State>;
-const ReduxDecorator = (Story: StoryFn) => {
+const ReduxDecorator = (Story: ComponentType) => {
return (
<MetabaseReduxProvider store={store}>
<Story />
diff --git a/frontend/src/metabase/documents/components/Editor/Editor.tsx b/frontend/src/metabase/documents/components/Editor/Editor.tsx
index 499638d0897..74035800652 100644
--- a/frontend/src/metabase/documents/components/Editor/Editor.tsx
+++ b/frontend/src/metabase/documents/components/Editor/Editor.tsx
@@ -100,7 +100,7 @@ export interface EditorProps {
editable?: boolean;
isLoading?: boolean;
/** Ref to the editor container for external access (e.g., anchor scrolling) */
- editorContainerRef?: React.RefObject<HTMLDivElement>;
+ editorContainerRef?: React.RefObject<HTMLDivElement | null>;
hostOverride?: Partial<DocumentEditorHost>;
placeholder?: string;
}
diff --git a/frontend/src/metabase/documents/hooks/use-document-editor.ts b/frontend/src/metabase/documents/hooks/use-document-editor.ts
index 522cb2270c8..694a320dfef 100644
--- a/frontend/src/metabase/documents/hooks/use-document-editor.ts
+++ b/frontend/src/metabase/documents/hooks/use-document-editor.ts
@@ -67,7 +67,7 @@ interface UseDocumentEditorResult {
setEditorInstance: Dispatch<SetStateAction<TiptapEditor | null>>;
collectionPickerMode: "save" | "move" | null;
setCollectionPickerMode: Dispatch<SetStateAction<"save" | "move" | null>>;
- editorContainerRef: RefObject<HTMLDivElement>;
+ editorContainerRef: RefObject<HTMLDivElement | null>;
isNavigationScheduled: boolean;
scheduleNavigation: ScheduleCallback;
isNewDocument: boolean;
diff --git a/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.ts b/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.ts
index 9fc89d21ee3..eab410c1878 100644
--- a/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.ts
+++ b/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.ts
@@ -6,7 +6,7 @@ interface UseScrollToAnchorOptions {
/** The block ID to scroll to (from location.hash, without the #) */
blockId: string | null;
/** Ref to the editor's DOM container */
- editorContainerRef: React.RefObject<HTMLElement>;
+ editorContainerRef: React.RefObject<HTMLElement | null>;
/** Whether the document is still loading */
isLoading: boolean;
}
diff --git a/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.unit.spec.ts b/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.unit.spec.ts
index c1fb4d7b5cf..b4c4d193fbd 100644
--- a/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.unit.spec.ts
+++ b/frontend/src/metabase/documents/hooks/use-scroll-to-anchor.unit.spec.ts
@@ -11,7 +11,7 @@ jest.mock("../components/DocumentPage.module.css", () => ({
describe("useScrollToAnchor", () => {
let container: HTMLDivElement;
- let editorContainerRef: React.RefObject<HTMLDivElement>;
+ let editorContainerRef: React.RefObject<HTMLDivElement | null>;
const mockScrollIntoView = getScrollIntoViewMock();
beforeEach(() => {
diff --git a/frontend/src/metabase/embedding-sdk/types/components/data-picker.ts b/frontend/src/metabase/embedding-sdk/types/components/data-picker.ts
index b55dedb7d83..516d14e1d8f 100644
--- a/frontend/src/metabase/embedding-sdk/types/components/data-picker.ts
+++ b/frontend/src/metabase/embedding-sdk/types/components/data-picker.ts
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { CardType, CollectionId, TableId } from "metabase-types/api";
export interface DataSourceSelectorProps {
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ClientEmbedCodePane.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ClientEmbedCodePane.tsx
index ed6f7f1dada..ff0ff348f09 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ClientEmbedCodePane.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ClientEmbedCodePane.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import type { ClientCodeSampleConfig } from "metabase/embedding/types";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/CodeSample.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/CodeSample.tsx
index a88e05275a3..ff5cf4d3b40 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/CodeSample.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/CodeSample.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import type { CodeLanguage } from "metabase/common/components/CodeEditor";
import { CodeEditor } from "metabase/common/components/CodeEditor";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
index ed9b2879d19..927f8369f3f 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/EmbedModalContentStatusBar.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { type JSX, useState } from "react";
import { match } from "ts-pattern";
import { t } from "ttag";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/LookAndFeelSettings.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/LookAndFeelSettings.tsx
index 03c5ac0d0fd..40ea5dafbbe 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/LookAndFeelSettings.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/LookAndFeelSettings.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { match } from "ts-pattern";
import { jt, t } from "ttag";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/OverviewSettings.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/OverviewSettings.tsx
index 8c84ade7c45..ceaf3e5acab 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/OverviewSettings.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/OverviewSettings.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useEffect, useState } from "react";
import { jt, t } from "ttag";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ParametersSettings.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ParametersSettings.tsx
index d2326142ae8..e9c22d13765 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ParametersSettings.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ParametersSettings.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { t } from "ttag";
import CS from "metabase/css/core/index.css";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/PreviewModeSelector.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/PreviewModeSelector.tsx
index 2910ccb73c2..6c9c6bc4dfb 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/PreviewModeSelector.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/PreviewModeSelector.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { SegmentedControl, type SegmentedControlItem } from "metabase/ui";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ServerEmbedCodePane.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ServerEmbedCodePane.tsx
index f9ebed832ee..5f63a89b1a6 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ServerEmbedCodePane.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/ServerEmbedCodePane.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
index 46672a7405a..c2fb7c24051 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/SettingsTabLayout.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import CS from "metabase/css/core/index.css";
import { Box, Flex, Stack } from "metabase/ui";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
index 3e85d01b14e..63741f80335 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPane.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useMemo, useState } from "react";
+import { type JSX, useMemo, useState } from "react";
import { useAsync } from "react-use";
import { t } from "ttag";
diff --git a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPaneSettingsContentSection.tsx b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPaneSettingsContentSection.tsx
index 7859dbd3b7f..a51f41cadf3 100644
--- a/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPaneSettingsContentSection.tsx
+++ b/frontend/src/metabase/embedding/components/EmbedModal/StaticEmbedSetupPane/StaticEmbedSetupPaneSettingsContentSection.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useUniqueId } from "metabase/common/hooks/use-unique-id";
import type { BoxProps } from "metabase/ui";
diff --git a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
index f3fd6c09af4..0d344d93e6c 100644
--- a/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
+++ b/frontend/src/metabase/embedding/components/PublicLinkPopover/PublicLinkPopover.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { useAsync } from "react-use";
import { t } from "ttag";
diff --git a/frontend/src/metabase/embedding/embedding-iframe-sdk/embed.unit.spec.ts b/frontend/src/metabase/embedding/embedding-iframe-sdk/embed.unit.spec.ts
index 970f4060d95..083fb527975 100644
--- a/frontend/src/metabase/embedding/embedding-iframe-sdk/embed.unit.spec.ts
+++ b/frontend/src/metabase/embedding/embedding-iframe-sdk/embed.unit.spec.ts
@@ -1,6 +1,6 @@
import fetchMock from "fetch-mock";
import jwt from "jsonwebtoken";
-import { act } from "react-dom/test-utils";
+import { act } from "react";
import type { NavigatedEntityParameterChangePayload } from "embedding-sdk-bundle/types/navigation";
diff --git a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/OnboardingStepper.tsx b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/OnboardingStepper.tsx
index dd9a7e9e1a0..520fb5bea2d 100644
--- a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/OnboardingStepper.tsx
+++ b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/OnboardingStepper.tsx
@@ -42,7 +42,7 @@ const OnboardingStepperRoot = forwardRef<
const stepIdToNumber: Record<string, number> = {};
Children.forEach(children, (child) => {
- if (isValidElement(child)) {
+ if (isValidElement<{ stepId?: string }>(child)) {
if (child.type === OnboardingStepperStep && child.props.stepId) {
const stepId = child.props.stepId;
ids.push(stepId);
diff --git a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/hooks/use-scroll-step-into-view.ts b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/hooks/use-scroll-step-into-view.ts
index a77c1d2ca34..b286f0f3063 100644
--- a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/hooks/use-scroll-step-into-view.ts
+++ b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/hooks/use-scroll-step-into-view.ts
@@ -1,7 +1,7 @@
import { createRef, useCallback, useMemo } from "react";
interface UseScrollStepIntoViewResult {
- stepRefs: Record<string, React.RefObject<HTMLDivElement>>;
+ stepRefs: Record<string, React.RefObject<HTMLDivElement | null>>;
scrollStepIntoView: (stepId: string | null) => void;
}
@@ -19,7 +19,7 @@ export function useScrollStepIntoView(
return refs;
},
// Unjustified type cast. FIXME
- {} as Record<string, React.RefObject<HTMLDivElement>>,
+ {} as Record<string, React.RefObject<HTMLDivElement | null>>,
);
}, [stepIds]);
diff --git a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/types.ts b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/types.ts
index dbd6147b0e2..c55ded8594d 100644
--- a/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/types.ts
+++ b/frontend/src/metabase/embedding/setup-guide/components/OnboardingStepper/types.ts
@@ -5,7 +5,7 @@ export interface StepperContextValue {
completedSteps: Record<string, boolean>;
lockedSteps: Record<string, boolean>;
stepNumbers: Record<string, number>;
- stepRefs: Record<string, React.RefObject<HTMLDivElement>>;
+ stepRefs: Record<string, React.RefObject<HTMLDivElement | null>>;
setActiveStep: (stepId: string | null) => void;
}
diff --git a/frontend/src/metabase/embedding/themes/components/ThemeEditor/EnableEmbeddingPrompt.tsx b/frontend/src/metabase/embedding/themes/components/ThemeEditor/EnableEmbeddingPrompt.tsx
index ec30e24566a..b034253e7a7 100644
--- a/frontend/src/metabase/embedding/themes/components/ThemeEditor/EnableEmbeddingPrompt.tsx
+++ b/frontend/src/metabase/embedding/themes/components/ThemeEditor/EnableEmbeddingPrompt.tsx
@@ -1,4 +1,5 @@
import { useDisclosure } from "@mantine/hooks";
+import type { JSX } from "react";
import { c, t } from "ttag";
import { EmbeddingLegaleseModal } from "metabase/embedding/settings/EmbeddingLegaleseModal";
diff --git a/frontend/src/metabase/forms/components/FormProvider/FormProvider.tsx b/frontend/src/metabase/forms/components/FormProvider/FormProvider.tsx
index bb9c03f960a..15755ff6948 100644
--- a/frontend/src/metabase/forms/components/FormProvider/FormProvider.tsx
+++ b/frontend/src/metabase/forms/components/FormProvider/FormProvider.tsx
@@ -1,6 +1,6 @@
import type { FormikConfig, FormikValues } from "formik";
import { Formik } from "formik";
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import type { FormStatus } from "../../contexts";
import { FormContext } from "../../contexts";
diff --git a/frontend/src/metabase/home/components/HomeCaption/HomeCaption.tsx b/frontend/src/metabase/home/components/HomeCaption/HomeCaption.tsx
index 49556d1ae2c..fcefa206253 100644
--- a/frontend/src/metabase/home/components/HomeCaption/HomeCaption.tsx
+++ b/frontend/src/metabase/home/components/HomeCaption/HomeCaption.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { Flex, Text } from "metabase/ui";
diff --git a/frontend/src/metabase/home/components/HomeCard/HomeCard.tsx b/frontend/src/metabase/home/components/HomeCard/HomeCard.tsx
index 1eba5ff837f..f99fd51d68b 100644
--- a/frontend/src/metabase/home/components/HomeCard/HomeCard.tsx
+++ b/frontend/src/metabase/home/components/HomeCard/HomeCard.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { Link } from "metabase/common/components/Link";
import { Card, Flex } from "metabase/ui";
diff --git a/frontend/src/metabase/home/components/HomeContent/HomeContent.tsx b/frontend/src/metabase/home/components/HomeContent/HomeContent.tsx
index 9eafc493a88..2b0b9b8125a 100644
--- a/frontend/src/metabase/home/components/HomeContent/HomeContent.tsx
+++ b/frontend/src/metabase/home/components/HomeContent/HomeContent.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import {
useListDatabasesQuery,
diff --git a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
index 38e4c5a2177..a8357b237ba 100644
--- a/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
+++ b/frontend/src/metabase/home/components/HomeGreeting/HomeGreeting.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useEffect, useMemo, useState } from "react";
+import { type JSX, useEffect, useMemo, useState } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/home/components/HomeHelpCard/HomeHelpCard.tsx b/frontend/src/metabase/home/components/HomeHelpCard/HomeHelpCard.tsx
index 6d98adb2231..a98c2983d18 100644
--- a/frontend/src/metabase/home/components/HomeHelpCard/HomeHelpCard.tsx
+++ b/frontend/src/metabase/home/components/HomeHelpCard/HomeHelpCard.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import { t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/home/components/HomeModelCard/HomeModelCard.tsx b/frontend/src/metabase/home/components/HomeModelCard/HomeModelCard.tsx
index 0036ae926e2..571a878c151 100644
--- a/frontend/src/metabase/home/components/HomeModelCard/HomeModelCard.tsx
+++ b/frontend/src/metabase/home/components/HomeModelCard/HomeModelCard.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { EntityIcon } from "metabase/common/components/EntityIcon";
import type { IconData } from "metabase/common/utils/icon";
import { Box, Ellipsified } from "metabase/ui";
diff --git a/frontend/src/metabase/home/components/HomePage/HomePage.tsx b/frontend/src/metabase/home/components/HomePage/HomePage.tsx
index 0e697cdddbe..6d250d49b7d 100644
--- a/frontend/src/metabase/home/components/HomePage/HomePage.tsx
+++ b/frontend/src/metabase/home/components/HomePage/HomePage.tsx
@@ -1,4 +1,4 @@
-import { useLayoutEffect } from "react";
+import { type JSX, useLayoutEffect } from "react";
import { t } from "ttag";
import { LoadingAndErrorWrapper } from "metabase/common/components/LoadingAndErrorWrapper";
diff --git a/frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.tsx b/frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.tsx
index 50f9c075ec1..2bb55487d37 100644
--- a/frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.tsx
+++ b/frontend/src/metabase/home/components/HomePopularSection/HomePopularSection.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/home/components/HomeXrayCard/HomeXrayCard.tsx b/frontend/src/metabase/home/components/HomeXrayCard/HomeXrayCard.tsx
index d30bec8a52b..fb9646f370e 100644
--- a/frontend/src/metabase/home/components/HomeXrayCard/HomeXrayCard.tsx
+++ b/frontend/src/metabase/home/components/HomeXrayCard/HomeXrayCard.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Ellipsified, Icon, Text } from "metabase/ui";
import { HomeCard } from "../HomeCard";
diff --git a/frontend/src/metabase/metabot/components/MetabotChat/hooks.ts b/frontend/src/metabase/metabot/components/MetabotChat/hooks.ts
index 9e0126bf9fc..4d701371e5f 100644
--- a/frontend/src/metabase/metabot/components/MetabotChat/hooks.ts
+++ b/frontend/src/metabase/metabot/components/MetabotChat/hooks.ts
@@ -25,8 +25,8 @@ export function calculateFillerHeight(
}
function resizeFillerArea(
- scrollContainerRef: RefObject<HTMLElement>,
- fillerRef: RefObject<HTMLElement>,
+ scrollContainerRef: RefObject<HTMLElement | null>,
+ fillerRef: RefObject<HTMLElement | null>,
) {
const scrollContainerEl = scrollContainerRef.current;
const fillerEl = fillerRef.current;
@@ -48,8 +48,8 @@ export function useScrollManager(hasMessages: boolean, conversationId: string) {
const scrollContainerRef = useRef<HTMLDivElement>(null);
const fillerRef = useRef<HTMLDivElement>(null);
- const resizeRafRef = useRef<number>();
- const scrollToPromptRafRef = useRef<number>();
+ const resizeRafRef = useRef<number>(undefined);
+ const scrollToPromptRafRef = useRef<number>(undefined);
const scheduleFillerResize = useCallback(() => {
// only schedule if nothing has been for this frame
diff --git a/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.tsx b/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.tsx
index 017b311fe3f..721b5c188e9 100644
--- a/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.tsx
+++ b/frontend/src/metabase/metabot/components/MetabotPromptInput/MetabotPromptInput.tsx
@@ -5,7 +5,7 @@ import { Placeholder } from "@tiptap/extension-placeholder";
import Text from "@tiptap/extension-text";
import { TextSelection } from "@tiptap/pm/state";
import type { EditorView } from "@tiptap/pm/view";
-import { EditorContent, useEditor } from "@tiptap/react";
+import { type Editor, EditorContent, useEditor } from "@tiptap/react";
import cx from "classnames";
import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
import { t } from "ttag";
@@ -195,22 +195,42 @@ export const MetabotPromptInput = forwardRef<
],
);
- useImperativeHandle(ref, () => {
+ useImperativeHandle<
+ MetabotPromptInputRef | null,
+ MetabotPromptInputRef | null
+ >(ref, () => {
if (!editor) {
return null;
}
- return Object.assign(editor, {
+ // The handle is the editor itself, widened with the public methods, so
+ // callers (and specs) can still reach `editor.view` / `editor.state`.
+ Object.assign(editor, {
focus: () => editor.commands.focus("end"),
clear: () => editor.commands.clearContent(),
getValue: () => serializeTiptapToMetabotMessage(editor.getJSON()),
- get scrollHeight() {
- return editor.view.dom.scrollHeight;
+ });
+
+ // Install the size accessors with `defineProperties` rather than through
+ // `Object.assign`, which would evaluate the getters eagerly. Under React
+ // 19 the editor view mounts after this handle runs, so reading
+ // `editor.view` now throws; keep it lazy until a caller reads the size.
+ Object.defineProperties(editor, {
+ scrollHeight: {
+ configurable: true,
+ get: () => editor.view.dom.scrollHeight,
},
- get scrollTop() {
- return editor.view.dom.scrollTop;
+ scrollTop: {
+ configurable: true,
+ get: () => editor.view.dom.scrollTop,
},
});
+
+ // The runtime handle is the editor itself, widened with the members
+ // assigned and defined above. Assert that intersection (the editor does
+ // carry them at runtime); the public ref type then narrows it to what
+ // consumers may touch.
+ return editor as Editor & MetabotPromptInputRef;
}, [editor]);
// Sync external value changes to editor
diff --git a/frontend/src/metabase/metabot/components/editor-extensions/MetabotMention/MetabotSuggestionNew.unit.spec.tsx b/frontend/src/metabase/metabot/components/editor-extensions/MetabotMention/MetabotSuggestionNew.unit.spec.tsx
index cf3311bd706..32f89275ebe 100644
--- a/frontend/src/metabase/metabot/components/editor-extensions/MetabotMention/MetabotSuggestionNew.unit.spec.tsx
+++ b/frontend/src/metabase/metabot/components/editor-extensions/MetabotMention/MetabotSuggestionNew.unit.spec.tsx
@@ -1,7 +1,7 @@
+import { act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import type { Editor } from "@tiptap/core";
import { createRef } from "react";
-import { act } from "react-dom/test-utils";
import { renderWithProviders, screen, waitFor } from "__support__/ui";
import type { EntityPickerModalProps } from "metabase/common/components/Pickers";
diff --git a/frontend/src/metabase/metabot/context.tsx b/frontend/src/metabase/metabot/context.tsx
index 3d0ff563d05..bf955632e57 100644
--- a/frontend/src/metabase/metabot/context.tsx
+++ b/frontend/src/metabase/metabot/context.tsx
@@ -37,7 +37,7 @@ export type MetabotPromptInputRef = {
export type MetabotCtx = {
prompt: string;
setPrompt: (prompt: string) => void;
- promptInputRef: RefObject<MetabotPromptInputRef> | undefined;
+ promptInputRef: RefObject<MetabotPromptInputRef | null> | undefined;
getChatContext: () => Promise<MetabotChatContext>;
registerChatContextProvider: (
diff --git a/frontend/src/metabase/metrics-viewer/components/EmptyState/MetricViewerEmptyState.tsx b/frontend/src/metabase/metrics-viewer/components/EmptyState/MetricViewerEmptyState.tsx
index 57278bb4c6d..9318f7d64af 100644
--- a/frontend/src/metabase/metrics-viewer/components/EmptyState/MetricViewerEmptyState.tsx
+++ b/frontend/src/metabase/metrics-viewer/components/EmptyState/MetricViewerEmptyState.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import lineChartImage from "assets/img/empty-states/visualizations/line.svg?url";
diff --git a/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchDropdown/MetricSearchDropdown.tsx b/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchDropdown/MetricSearchDropdown.tsx
index 33adf87c7c4..3d58d200d12 100644
--- a/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchDropdown/MetricSearchDropdown.tsx
+++ b/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchDropdown/MetricSearchDropdown.tsx
@@ -30,7 +30,7 @@ import type { MetricNameMap } from "../utils";
export interface MetricSearchDropdownRef {
onArrowDown: () => boolean;
onArrowUp: () => boolean;
- containerRef: React.RefObject<HTMLDivElement>;
+ containerRef: React.RefObject<HTMLDivElement | null>;
}
type MetricSearchDropdownProps = {
diff --git a/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchInput/editorExtensions.ts b/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchInput/editorExtensions.ts
index 9ac603bdde2..bb5e59e548a 100644
--- a/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchInput/editorExtensions.ts
+++ b/frontend/src/metabase/metrics-viewer/components/MetricSearch/MetricSearchInput/editorExtensions.ts
@@ -12,7 +12,7 @@ import { trustedDocChangesOnly } from "./trustedDocChangesOnly";
type EditorExtensionRefs = {
handleRunRef: { current: () => void };
- dropdownRef: React.RefObject<MetricSearchDropdownRef>;
+ dropdownRef: React.RefObject<MetricSearchDropdownRef | null>;
};
export function buildEditorExtensions(
diff --git a/frontend/src/metabase/monitor/tools/components/Logs/hooks.ts b/frontend/src/metabase/monitor/tools/components/Logs/hooks.ts
index 125d7fbc23b..a3a346b7e59 100644
--- a/frontend/src/metabase/monitor/tools/components/Logs/hooks.ts
+++ b/frontend/src/metabase/monitor/tools/components/Logs/hooks.ts
@@ -32,7 +32,7 @@ export function usePollingLogsQuery(pollingDurationMs: number) {
}
export function useTailLogs(logs: Log[]) {
- const scrollRef = useRef<any>();
+ const scrollRef = useRef<any>(undefined);
const shouldAutoFollow = useRef(true);
function autoFollow() {
diff --git a/frontend/src/metabase/nav/components/AppBar/AppBar.tsx b/frontend/src/metabase/nav/components/AppBar/AppBar.tsx
index 627f917d6c4..66af9380472 100644
--- a/frontend/src/metabase/nav/components/AppBar/AppBar.tsx
+++ b/frontend/src/metabase/nav/components/AppBar/AppBar.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { t } from "ttag";
import ErrorBoundary from "metabase/common/components/ErrorBoundary";
diff --git a/frontend/src/metabase/nav/components/AppBar/AppBarLarge.tsx b/frontend/src/metabase/nav/components/AppBar/AppBarLarge.tsx
index cd7d3a43da4..013ddcb7945 100644
--- a/frontend/src/metabase/nav/components/AppBar/AppBarLarge.tsx
+++ b/frontend/src/metabase/nav/components/AppBar/AppBarLarge.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { t } from "ttag";
import { Nav as DetailViewNav } from "metabase/detail-view/components";
diff --git a/frontend/src/metabase/nav/components/AppBar/AppBarLogo.tsx b/frontend/src/metabase/nav/components/AppBar/AppBarLogo.tsx
index 7ff8535805e..5c6c28bc9c7 100644
--- a/frontend/src/metabase/nav/components/AppBar/AppBarLogo.tsx
+++ b/frontend/src/metabase/nav/components/AppBar/AppBarLogo.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { MouseEvent } from "react";
+import type { JSX, MouseEvent } from "react";
import { Link } from "metabase/common/components/Link";
import { LogoIcon } from "metabase/common/components/LogoIcon";
diff --git a/frontend/src/metabase/nav/components/AppBar/AppBarSmall.tsx b/frontend/src/metabase/nav/components/AppBar/AppBarSmall.tsx
index 193c71dc06f..7a79d554026 100644
--- a/frontend/src/metabase/nav/components/AppBar/AppBarSmall.tsx
+++ b/frontend/src/metabase/nav/components/AppBar/AppBarSmall.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { type ReactNode, useCallback, useState } from "react";
+import { type JSX, type ReactNode, useCallback, useState } from "react";
import { Nav as DetailViewNav } from "metabase/detail-view/components";
import { MetabotAppBarButton } from "metabase/metabot/components/MetabotAppBarButton";
diff --git a/frontend/src/metabase/nav/components/AppBar/AppBarToggle.tsx b/frontend/src/metabase/nav/components/AppBar/AppBarToggle.tsx
index 7b6c89bd769..79e1d52ddeb 100644
--- a/frontend/src/metabase/nav/components/AppBar/AppBarToggle.tsx
+++ b/frontend/src/metabase/nav/components/AppBar/AppBarToggle.tsx
@@ -1,7 +1,7 @@
import { useHover } from "@mantine/hooks";
import cx from "classnames";
import type React from "react";
-import { useEffect, useState } from "react";
+import { type JSX, useEffect, useState } from "react";
import { t } from "ttag";
import CS from "metabase/css/core/index.css";
diff --git a/frontend/src/metabase/nav/components/CollectionBreadcrumbs/CollectionBreadcrumbs.tsx b/frontend/src/metabase/nav/components/CollectionBreadcrumbs/CollectionBreadcrumbs.tsx
index a65b325305d..c9a4957c7df 100644
--- a/frontend/src/metabase/nav/components/CollectionBreadcrumbs/CollectionBreadcrumbs.tsx
+++ b/frontend/src/metabase/nav/components/CollectionBreadcrumbs/CollectionBreadcrumbs.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { useTranslateContent } from "metabase/content-translation/hooks";
import * as Urls from "metabase/urls";
import type {
diff --git a/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx b/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
index 802fe37aad4..a0ff5193a42 100644
--- a/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
+++ b/frontend/src/metabase/nav/components/search/SearchResults/SearchResults.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useEffect, useMemo, useState } from "react";
import { useDebounce } from "react-use";
import { t } from "ttag";
diff --git a/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx b/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx
index defa35e3759..2224629eea8 100644
--- a/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx
+++ b/frontend/src/metabase/nav/containers/MainNavbar/SidebarItems/SidebarCollectionLink.tsx
@@ -51,7 +51,7 @@ const SidebarCollectionLink = forwardRef<HTMLLIElement, Props>(
ref,
) {
const wasHovered = usePrevious(isHovered);
- const timeoutId = useRef<number>();
+ const timeoutId = useRef<number>(undefined);
const isTenantUser = useSelector(getIsTenantUser);
useEffect(() => {
diff --git a/frontend/src/metabase/palette/components/Palette.stories.tsx b/frontend/src/metabase/palette/components/Palette.stories.tsx
index 2c4c79c1feb..80cb1412f3a 100644
--- a/frontend/src/metabase/palette/components/Palette.stories.tsx
+++ b/frontend/src/metabase/palette/components/Palette.stories.tsx
@@ -1,10 +1,10 @@
// @ts-expect-error There is no type definition
import createAsyncCallback from "@loki/create-async-callback";
import type { Store } from "@reduxjs/toolkit";
-import type { StoryFn } from "@storybook/react";
import { expect, userEvent, within } from "@storybook/test";
import { KBarProvider, VisualState, useKBar } from "kbar";
import { HttpResponse, http } from "msw";
+import type { ComponentType } from "react";
import { getCommonStore } from "__support__/entities-store";
import { mockSettings } from "__support__/settings";
@@ -36,7 +36,7 @@ registerVisualization(Table);
// Unjustified type cast. FIXME
const store = getCommonStore(storeInitialState) as unknown as Store<State>;
-const ReduxDecorator = (Story: StoryFn) => {
+const ReduxDecorator = (Story: ComponentType) => {
return (
<MetabaseReduxProvider store={store}>
<KBarProvider>
diff --git a/frontend/src/metabase/palette/components/Palette.tsx b/frontend/src/metabase/palette/components/Palette.tsx
index 7b101f4914c..f6472a3525f 100644
--- a/frontend/src/metabase/palette/components/Palette.tsx
+++ b/frontend/src/metabase/palette/components/Palette.tsx
@@ -60,7 +60,7 @@ export const PaletteContainer = ({
locationQuery: SearchQuery;
}) => {
const { query } = useKBar();
- const ref = useRef(null);
+ const ref = useRef<HTMLDivElement>(null);
const searchText = typeof locationQuery.q === "string" ? locationQuery.q : "";
const {
diff --git a/frontend/src/metabase/palette/shortcuts/global-shortcuts.unit.spec.tsx b/frontend/src/metabase/palette/shortcuts/global-shortcuts.unit.spec.tsx
index c65c3699c31..46dfa080cd4 100644
--- a/frontend/src/metabase/palette/shortcuts/global-shortcuts.unit.spec.tsx
+++ b/frontend/src/metabase/palette/shortcuts/global-shortcuts.unit.spec.tsx
@@ -79,9 +79,16 @@ describe("global keyboard shortcuts", () => {
])("%s navigates to %s", async (_name, keys, pathname) => {
const { router } = await setup();
- await userEvent.keyboard(keys);
-
- await waitFor(() => expect(router?.location.pathname).toBe(pathname));
+ // The shortcut handler registers in an effect that runs after setup
+ // resolves, so under load the first keystroke can land before it is
+ // listening and is dropped. Re-send until the navigation takes, but never
+ // after it has, so we don't fire the shortcut on the destination page.
+ await waitFor(async () => {
+ if (router?.location.pathname !== pathname) {
+ await userEvent.keyboard(keys);
+ }
+ expect(router?.location.pathname).toBe(pathname);
+ });
});
it("does not navigate to Data Studio for users without access", async () => {
diff --git a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceCardModal.tsx b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceCardModal.tsx
index af050821428..8ce0777fb56 100644
--- a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceCardModal.tsx
+++ b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceCardModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { skipToken, useGetCardQuery } from "metabase/api";
diff --git a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.tsx b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.tsx
index 2e6be80c06a..8993ef57cb7 100644
--- a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.tsx
+++ b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useState } from "react";
+import { type JSX, useCallback, useState } from "react";
import type { UiParameter } from "metabase-lib/v1/parameters/types";
import { hasFields } from "metabase-lib/v1/parameters/utils/parameter-fields";
diff --git a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceTypeModal.tsx b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceTypeModal.tsx
index 8177366bc99..693c8343da4 100644
--- a/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceTypeModal.tsx
+++ b/frontend/src/metabase/parameters/components/ValuesSourceModal/ValuesSourceTypeModal.tsx
@@ -1,4 +1,4 @@
-import type { ChangeEvent, ReactNode } from "react";
+import type { ChangeEvent, JSX, ReactNode } from "react";
import { useCallback, useLayoutEffect, useMemo } from "react";
import { useAsyncFn } from "react-use";
import { jt, t } from "ttag";
diff --git a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/FieldValuesWidget.tsx b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/FieldValuesWidget.tsx
index 1d8605ec4c6..ce7d57788cb 100644
--- a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/FieldValuesWidget.tsx
+++ b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/FieldValuesWidget.tsx
@@ -1,5 +1,6 @@
import cx from "classnames";
import {
+ type JSX,
type StyleHTMLAttributes,
forwardRef,
useEffect,
diff --git a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/SingleSelectListField/types.ts b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/SingleSelectListField/types.ts
index 84386dbd543..9d96dda82f1 100644
--- a/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/SingleSelectListField/types.ts
+++ b/frontend/src/metabase/parameters/components/widgets/ParameterFieldWidget/FieldValuesWidget/SingleSelectListField/types.ts
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { FieldValue, RowValue } from "metabase-types/api";
export type Option = FieldValue;
diff --git a/frontend/src/metabase/plugins/components/PluginPlaceholder/PluginPlaceholder.tsx b/frontend/src/metabase/plugins/components/PluginPlaceholder/PluginPlaceholder.tsx
index dd35056bf21..fda74d8c9ea 100644
--- a/frontend/src/metabase/plugins/components/PluginPlaceholder/PluginPlaceholder.tsx
+++ b/frontend/src/metabase/plugins/components/PluginPlaceholder/PluginPlaceholder.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { PluginRoute } from "metabase/plugins/types";
interface Props {
diff --git a/frontend/src/metabase/plugins/oss/collections.ts b/frontend/src/metabase/plugins/oss/collections.ts
index 5aca83119d9..6a2b458463a 100644
--- a/frontend/src/metabase/plugins/oss/collections.ts
+++ b/frontend/src/metabase/plugins/oss/collections.ts
@@ -1,5 +1,5 @@
import type React from "react";
-import type { ComponentType } from "react";
+import type { ComponentType, JSX } from "react";
import { t } from "ttag";
import type {
diff --git a/frontend/src/metabase/plugins/oss/model-persistence.ts b/frontend/src/metabase/plugins/oss/model-persistence.ts
index 2b518be4116..f874fb5bcfa 100644
--- a/frontend/src/metabase/plugins/oss/model-persistence.ts
+++ b/frontend/src/metabase/plugins/oss/model-persistence.ts
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { PluginPlaceholder } from "metabase/plugins/components/PluginPlaceholder";
import type Question from "metabase-lib/v1/Question";
import type { ModelCacheRefreshStatus } from "metabase-types/api";
diff --git a/frontend/src/metabase/plugins/oss/notifications-sdk.ts b/frontend/src/metabase/plugins/oss/notifications-sdk.ts
index c4d1cbfc52c..8a75d919d2f 100644
--- a/frontend/src/metabase/plugins/oss/notifications-sdk.ts
+++ b/frontend/src/metabase/plugins/oss/notifications-sdk.ts
@@ -1,4 +1,4 @@
-import type { ButtonHTMLAttributes } from "react";
+import type { ButtonHTMLAttributes, JSX } from "react";
import type { ActionIconProps } from "metabase/ui";
diff --git a/frontend/src/metabase/plugins/types.ts b/frontend/src/metabase/plugins/types.ts
index 1b1230d8aee..008cc8ffdb4 100644
--- a/frontend/src/metabase/plugins/types.ts
+++ b/frontend/src/metabase/plugins/types.ts
@@ -1,4 +1,4 @@
-import type { ComponentType } from "react";
+import type { ComponentType, JSX } from "react";
import type { CollectionTreeItem } from "metabase/common/collections/utils";
import type { ConfirmationState } from "metabase/common/hooks/use-confirmation";
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-card-filters.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-card-filters.stories.tsx
index 10e3654efd1..ce6256905c7 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-card-filters.stories.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-card-filters.stories.tsx
@@ -1,6 +1,7 @@
import type { StoryContext, StoryFn } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { HttpResponse, http } from "msw";
+import type { ComponentType } from "react";
import _ from "underscore";
import { getPublicStore } from "__support__/entities-store";
@@ -54,7 +55,7 @@ export default {
},
};
-function ReduxDecorator(Story: StoryFn, context: StoryContext) {
+function ReduxDecorator(Story: ComponentType, context: StoryContext) {
// Unjustified type cast. FIXME
const dashboard = context.args.dashboard as Dashboard;
const initialState = createMockState({
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-filters.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-filters.stories.tsx
index 994d665d768..5bc8f50abae 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-filters.stories.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-filters.stories.tsx
@@ -1,6 +1,7 @@
import type { StoryContext, StoryFn } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { HttpResponse, http } from "msw";
+import type { ComponentType } from "react";
import _ from "underscore";
import { getPublicStore } from "__support__/entities-store";
@@ -79,7 +80,7 @@ export default {
},
};
-function ReduxDecorator(Story: StoryFn, context: StoryContext) {
+function ReduxDecorator(Story: ComponentType, context: StoryContext) {
// Unjustified type cast. FIXME
const dashboard = context.args.dashboard as Dashboard;
// Unjustified type cast. FIXME
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-pdf-export.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-pdf-export.stories.tsx
index 023487d0580..6ec3751d17a 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-pdf-export.stories.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView-pdf-export.stories.tsx
@@ -3,6 +3,7 @@ import createAsyncCallback from "@loki/create-async-callback";
import type { StoryContext, StoryFn } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { HttpResponse, http } from "msw";
+import type { ComponentType } from "react";
import { getPublicStore } from "__support__/entities-store";
import {
@@ -61,7 +62,7 @@ const DASHBOARD_ID = getNextId();
const DASHCARD_MAP_ID = getNextId();
const CARD_MAP_ID = getNextId();
-function ReduxDecorator(Story: StoryFn, context: StoryContext) {
+function ReduxDecorator(Story: ComponentType, context: StoryContext) {
// Unjustified type cast. FIXME
const dashboard = (context.args.dashboard as Dashboard) ?? createDashboard();
const initialState = createMockState({
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx
index 4dc4b8f44e2..4e4bde3efd9 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedDashboard/PublicOrEmbeddedDashboardView.stories.tsx
@@ -2,7 +2,7 @@
import createAsyncCallback from "@loki/create-async-callback";
import type { StoryContext, StoryFn } from "@storybook/react";
import { HttpResponse, http } from "msw";
-import { useEffect, useMemo } from "react";
+import { type ComponentType, useEffect, useMemo } from "react";
import _ from "underscore";
import { getPublicStore } from "__support__/entities-store";
@@ -11,7 +11,10 @@ import {
createMockSettingsState,
createMockState,
} from "__support__/state";
-import { createWaitForResizeToStopDecorator } from "__support__/storybook";
+import {
+ createWaitForChartsDecorator,
+ createWaitForResizeToStopDecorator,
+} from "__support__/storybook";
import { getNextId } from "__support__/utils";
import { NumberColumn, StringColumn } from "__support__/visualizations";
import { DASHBOARD_DISPLAY_ACTIONS } from "metabase/dashboard/components/DashboardHeader/DashboardHeaderButtonRow/constants";
@@ -50,7 +53,11 @@ registerVisualization(BarChart);
export default {
title: "App/Embed/PublicOrEmbeddedDashboardView",
component: PublicOrEmbeddedDashboardView,
- decorators: [ReduxDecorator, createWaitForResizeToStopDecorator()],
+ decorators: [
+ ReduxDecorator,
+ createWaitForChartsDecorator(),
+ createWaitForResizeToStopDecorator(),
+ ],
parameters: {
layout: "fullscreen",
msw: {
@@ -63,7 +70,7 @@ export default {
},
};
-function ReduxDecorator(Story: StoryFn, context: StoryContext) {
+function ReduxDecorator(Story: ComponentType, context: StoryContext) {
// Unjustified type cast. FIXME
const dashboard = (context.args.dashboard as Dashboard) ?? createDashboard();
const initialState = createMockState({
@@ -442,7 +449,7 @@ export const CardVisualizationsDarkTheme = {
},
};
-function ScrollDecorator(Story: StoryFn) {
+function ScrollDecorator(Story: ComponentType) {
const asyncCallback = useMemo(() => createAsyncCallback(), []);
useEffect(() => {
@@ -464,7 +471,7 @@ function ScrollDecorator(Story: StoryFn) {
return <Story />;
}
-function DarkBackgroundDecorator(Story: StoryFn) {
+function DarkBackgroundDecorator(Story: ComponentType) {
return (
<Box style={{ backgroundColor: "#434e56" }} mih="100vh">
<Story />
@@ -472,7 +479,7 @@ function DarkBackgroundDecorator(Story: StoryFn) {
);
}
-function LightBackgroundDecorator(Story: StoryFn) {
+function LightBackgroundDecorator(Story: ComponentType) {
return (
<Box style={{ backgroundColor: "#ddd" }} mih="100vh">
<Story />
@@ -480,7 +487,7 @@ function LightBackgroundDecorator(Story: StoryFn) {
);
}
-function NarrowDecorator(Story: StoryFn) {
+function NarrowDecorator(Story: ComponentType) {
return (
<Box w={800} h={600} style={{ position: "relative" }}>
<Story />
diff --git a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestionView.stories.tsx b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestionView.stories.tsx
index 38fb8ebeb91..1493120e9ba 100644
--- a/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestionView.stories.tsx
+++ b/frontend/src/metabase/public/containers/PublicOrEmbeddedQuestion/PublicOrEmbeddedQuestionView.stories.tsx
@@ -3,11 +3,14 @@ import createAsyncCallback from "@loki/create-async-callback";
import type { StoryFn } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { HttpResponse, http } from "msw";
-import type { ComponentProps } from "react";
+import type { ComponentProps, ComponentType } from "react";
import { getPublicStore } from "__support__/entities-store";
import { createMockSettingsState, createMockState } from "__support__/state";
-import { createWaitForResizeToStopDecorator } from "__support__/storybook";
+import {
+ createWaitForChartsDecorator,
+ createWaitForResizeToStopDecorator,
+} from "__support__/storybook";
import { getNextId } from "__support__/utils";
import {
DateTimeColumn,
@@ -43,7 +46,11 @@ registerVisualization(Table);
export default {
title: "App/Embed/PublicOrEmbeddedQuestionView",
component: PublicOrEmbeddedQuestionView,
- decorators: [ReduxDecorator, createWaitForResizeToStopDecorator()],
+ decorators: [
+ ReduxDecorator,
+ createWaitForChartsDecorator(),
+ createWaitForResizeToStopDecorator(),
+ ],
parameters: {
layout: "fullscreen",
msw: {
@@ -69,7 +76,7 @@ export default {
},
};
-function ReduxDecorator(Story: StoryFn) {
+function ReduxDecorator(Story: ComponentType) {
return (
<MetabaseReduxProvider store={store}>
<Story />
@@ -186,7 +193,7 @@ export const TransparentThemeDefault = {
decorators: [LightBackgroundDecorator],
};
-function LightBackgroundDecorator(Story: StoryFn) {
+function LightBackgroundDecorator(Story: ComponentType) {
return (
<Box bg="background_page-primary" h="100%">
<Story />
@@ -443,7 +450,7 @@ export const TableLightTheme = {
},
};
-function NarrowContainer(Story: StoryFn) {
+function NarrowContainer(Story: ComponentType) {
return (
<Box w="300px" h="250px" pos="relative">
<Story />
diff --git a/frontend/src/metabase/query_builder/actions/core/core.ts b/frontend/src/metabase/query_builder/actions/core/core.ts
index 88669a8f75d..df8386d57c9 100644
--- a/frontend/src/metabase/query_builder/actions/core/core.ts
+++ b/frontend/src/metabase/query_builder/actions/core/core.ts
@@ -342,7 +342,17 @@ export const apiCreateQuestion = (
display: "list",
})
: createdQuestionWithMetadata.composeQuestionAdhoc();
- dispatch(runQuestionQuery({ overrideWithQuestion: composedQuestion }));
+ // Run the composed adhoc query for results only. Its URL is the adhoc
+ // /question/query, but the canonical URL is the saved model's /model/:id,
+ // written by the updateUrl the create flow schedules. Letting the adhoc run
+ // mirror its URL leaves that navigation pending when the model redirect
+ // fires, and the redirect sits out for it (metabase#51020).
+ dispatch(
+ runQuestionQuery({
+ overrideWithQuestion: composedQuestion,
+ shouldUpdateUrl: false,
+ }),
+ );
}
return createdQuestionWithMetadata;
diff --git a/frontend/src/metabase/query_builder/actions/url.ts b/frontend/src/metabase/query_builder/actions/url.ts
index 10dac52dc31..f86d8c35208 100644
--- a/frontend/src/metabase/query_builder/actions/url.ts
+++ b/frontend/src/metabase/query_builder/actions/url.ts
@@ -4,7 +4,7 @@ import { isEqualCard } from "metabase/common/utils/card";
import { selectQuestionFromOptsBuilder } from "metabase/metadata-store";
import { createThunkAction } from "metabase/redux";
import type { Path } from "metabase/router";
-import { getIsNavigationPending, navigate } from "metabase/router";
+import { getPendingNavigationPath, navigate } from "metabase/router";
import { getBasename } from "metabase/utils/basename";
import * as Lib from "metabase-lib";
import type Question from "metabase-lib/v1/Question";
@@ -138,8 +138,14 @@ export const updateUrl = createThunkAction(
// question was just saved into. A `route.lazy` destination keeps the query
// builder mounted until its chunk resolves, and this navigation would
// replace that pending one. The URL only mirrors the card, so there is
- // nothing to write if we are leaving.
- if (getIsNavigationPending()) {
+ // nothing to write if we are leaving to a different destination.
+ //
+ // Only a pending navigation to a *different* path is someone else's, so
+ // sit out for that one alone. Under React 19 the lazy destination keeps
+ // the navigation pending a render longer, so a blanket check here dropped
+ // the post-save URL sync to the card's own page (metabase#51020).
+ const pendingPath = getPendingNavigationPath();
+ if (pendingPath != null && pendingPath !== to.pathname) {
return;
}
diff --git a/frontend/src/metabase/query_builder/actions/url.unit.spec.ts b/frontend/src/metabase/query_builder/actions/url.unit.spec.ts
index a8e46775237..b4802f47bc1 100644
--- a/frontend/src/metabase/query_builder/actions/url.unit.spec.ts
+++ b/frontend/src/metabase/query_builder/actions/url.unit.spec.ts
@@ -16,7 +16,7 @@ import type { DraftQuestionBuilder } from "metabase/metadata-store";
import {
type NavigateOptions,
type To,
- getIsNavigationPending,
+ getPendingNavigationPath,
navigate,
} from "metabase/router";
import * as Urls from "metabase/urls";
@@ -40,7 +40,7 @@ registerVisualizations();
jest.mock("metabase/router", () => ({
...jest.requireActual("metabase/router"),
navigate: jest.fn(),
- getIsNavigationPending: jest.fn(() => false),
+ getPendingNavigationPath: jest.fn(() => null),
}));
type UpdateUrlOptions = Parameters<typeof updateUrl>[1];
@@ -132,7 +132,7 @@ describe("QB Actions > updateUrl (navigation producer contract)", () => {
jest.mocked(navigate).mockClear();
// Reset here rather than at the end of the test that sets it, so a failing
// expectation cannot leak the pending state into the tests that follow.
- jest.mocked(getIsNavigationPending).mockReturnValue(false);
+ jest.mocked(getPendingNavigationPath).mockReturnValue(null);
jest.spyOn(console, "warn").mockImplementation(() => {});
window.history.replaceState({}, "", "/");
});
@@ -279,8 +279,8 @@ describe("QB Actions > updateUrl (navigation producer contract)", () => {
// query builder mounted while its chunk loads, so this can run after the user
// has been sent elsewhere, and a navigation here would replace that pending
// one. See dashboard-questions.cy.spec.js, which caught it.
- it("does not navigate while the router has a navigation pending", async () => {
- jest.mocked(getIsNavigationPending).mockReturnValue(true);
+ it("does not navigate while a navigation to a different path is pending", async () => {
+ jest.mocked(getPendingNavigationPath).mockReturnValue("/dashboard/1");
const card = createSavedStructuredCard();
await setup({
@@ -291,6 +291,23 @@ describe("QB Actions > updateUrl (navigation producer contract)", () => {
expect(navigate).not.toHaveBeenCalled();
});
+ // A pending navigation to the same path the URL mirror targets is this card's
+ // own, not a redirect elsewhere. React 19 keeps the lazy destination pending a
+ // render longer, so a blanket pending check dropped this sync (metabase#51020).
+ it("navigates when the pending navigation targets the same path", async () => {
+ const card = createSavedStructuredCard();
+ jest
+ .mocked(getPendingNavigationPath)
+ .mockReturnValue("/question/1-question");
+
+ await setup({
+ question: buildSavedQuestion(card),
+ options: { dirty: true },
+ });
+
+ expect(navigate).toHaveBeenCalled();
+ });
+
it("flows objectId through onto location.state", async () => {
const card = createSavedStructuredCard();
const question = buildSavedQuestion(card);
diff --git a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetFieldMetadataSidebar/MappedFieldPicker/MappedFieldPicker.tsx b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetFieldMetadataSidebar/MappedFieldPicker/MappedFieldPicker.tsx
index de4b485e4f4..f9af9328d7d 100644
--- a/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetFieldMetadataSidebar/MappedFieldPicker/MappedFieldPicker.tsx
+++ b/frontend/src/metabase/query_builder/components/DatasetEditor/DatasetFieldMetadataSidebar/MappedFieldPicker/MappedFieldPicker.tsx
@@ -41,7 +41,7 @@ export function MappedFieldPicker({
const selectedField = field && selectedFieldId ? field : null;
- const selectButtonRef = useRef<HTMLButtonElement>();
+ const selectButtonRef = useRef<HTMLButtonElement>(undefined);
const focusSelectButton = useCallback(() => {
selectButtonRef.current?.focus();
diff --git a/frontend/src/metabase/query_builder/components/view/QuestionTimelineWidget/QuestionTimelineWidget.tsx b/frontend/src/metabase/query_builder/components/view/QuestionTimelineWidget/QuestionTimelineWidget.tsx
index ce783e7b12f..a9a9f13934b 100644
--- a/frontend/src/metabase/query_builder/components/view/QuestionTimelineWidget/QuestionTimelineWidget.tsx
+++ b/frontend/src/metabase/query_builder/components/view/QuestionTimelineWidget/QuestionTimelineWidget.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { useDispatch, useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ToggleNativeQueryPreview/ToggleNativeQueryPreview.tsx b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ToggleNativeQueryPreview/ToggleNativeQueryPreview.tsx
index ef73b2c668a..6e79f0a3c65 100644
--- a/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ToggleNativeQueryPreview/ToggleNativeQueryPreview.tsx
+++ b/frontend/src/metabase/query_builder/components/view/ViewHeader/components/ToggleNativeQueryPreview/ToggleNativeQueryPreview.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { getEngineNativeType } from "metabase/databases/utils/engine";
diff --git a/frontend/src/metabase/query_builder/components/view/sidebars/DatasetManagementSection/DatasetMetadataStrengthIndicator/DatasetMetadataStrengthIndicator.tsx b/frontend/src/metabase/query_builder/components/view/sidebars/DatasetManagementSection/DatasetMetadataStrengthIndicator/DatasetMetadataStrengthIndicator.tsx
index 21404aa6f96..8eab1c7c547 100644
--- a/frontend/src/metabase/query_builder/components/view/sidebars/DatasetManagementSection/DatasetMetadataStrengthIndicator/DatasetMetadataStrengthIndicator.tsx
+++ b/frontend/src/metabase/query_builder/components/view/sidebars/DatasetManagementSection/DatasetMetadataStrengthIndicator/DatasetMetadataStrengthIndicator.tsx
@@ -1,4 +1,4 @@
-import { useRef } from "react";
+import { type RefObject, useRef } from "react";
import { useHoverDirty } from "react-use";
import { t } from "ttag";
@@ -62,7 +62,8 @@ const TOOLTIP_DELAY = 700;
export function DatasetMetadataStrengthIndicator({ dataset, ...props }: Props) {
const rootRef = useRef<HTMLDivElement>(null);
- const isHovering = useHoverDirty(rootRef);
+ // react-use types the ref as non-null but only reads `.current`.
+ const isHovering = useHoverDirty(rootRef as RefObject<Element>);
const resultMetadata = dataset.getResultMetadata();
if (!Array.isArray(resultMetadata) || resultMetadata.length === 0) {
diff --git a/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx b/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
index 18f02093364..454ea2b555e 100644
--- a/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
+++ b/frontend/src/metabase/query_builder/components/view/sidebars/QuestionInfoSidebar/QuestionPublicLinkPopover/QuestionPublicLinkPopover.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { type JSX, useState } from "react";
import {
useCreateCardPublicLinkMutation,
diff --git a/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx b/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx
index d0311037faf..334faa23e7c 100644
--- a/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx
+++ b/frontend/src/metabase/query_builder/containers/QueryBuilder.tsx
@@ -24,7 +24,7 @@ import {
} from "metabase/current-user";
import { usePageTitleWithLoadingTime } from "metabase/hooks/use-page-title";
import { VISUALIZATION_SLOW_TIMEOUT } from "metabase/querying/constants";
-import { connect, useSelector } from "metabase/redux";
+import { connect, useSelector, useStore } from "metabase/redux";
import {
editSummary,
setIsNativeEditorOpen,
@@ -318,8 +318,6 @@ function QueryBuilderInner(props: QueryBuilderInnerProps) {
useListTimelinesQuery({ include: "events" });
const {
- question,
- originalQuestion,
uiControls,
initializeQB,
locationChanged,
@@ -378,7 +376,7 @@ function QueryBuilderInner(props: QueryBuilderInnerProps) {
() => _.debounce(forceUpdate, 400),
[forceUpdate],
);
- const timeout = useRef<number>();
+ const timeout = useRef<number>(undefined);
const previousUIControls = usePrevious(uiControls);
const previousLocation = usePrevious(location);
@@ -511,15 +509,31 @@ function QueryBuilderInner(props: QueryBuilderInnerProps) {
setIsShowingToaster(false);
}, []);
- const isNewQuestion = !originalQuestion;
- const isLocationAllowed = useCallback(
- (location?: Location) =>
- isNavigationAllowed({
+ const store = useStore();
+ const isCallbackScheduledRef = useRef(isCallbackScheduled);
+ isCallbackScheduledRef.current = isCallbackScheduled;
+
+ // Decide blocking from the store at call time, not from values captured in
+ // render. React 19 can run a Back navigation against a render that has not
+ // committed the freshly-dirtied question yet, so a render-captured decision
+ // reads the question as clean and lets the navigation through without the
+ // discard prompt (metabase#76382).
+ const isBlocking = useCallback(
+ (location?: Location) => {
+ const state = store.getState();
+ if (
+ !getShouldShowUnsavedChangesWarning(state) ||
+ isCallbackScheduledRef.current
+ ) {
+ return false;
+ }
+ return !isNavigationAllowed({
destination: location,
- question,
- isNewQuestion,
- }),
- [question, isNewQuestion],
+ question: getQuestion(state),
+ isNewQuestion: !getOriginalQuestion(state),
+ });
+ },
+ [store],
);
const handleCmdEnter = () => {
@@ -552,7 +566,7 @@ function QueryBuilderInner(props: QueryBuilderInnerProps) {
<LeaveRouteConfirmModal
isEnabled={shouldShowUnsavedChangesWarning && !isCallbackScheduled}
- isLocationAllowed={isLocationAllowed}
+ isBlocking={isBlocking}
/>
</>
);
diff --git a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx
index 85c121f3613..3832d87da72 100644
--- a/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx
+++ b/frontend/src/metabase/querying/common/components/DataSelector/saved-entity-picker/SavedEntityList.tsx
@@ -1,4 +1,4 @@
-import { Fragment } from "react";
+import { Fragment, type JSX } from "react";
import { t } from "ttag";
import { skipToken, useListCollectionItemsQuery } from "metabase/api";
diff --git a/frontend/src/metabase/querying/common/components/DatePicker/DatePicker.stories.tsx b/frontend/src/metabase/querying/common/components/DatePicker/DatePicker.stories.tsx
index d62e0fe0657..349638700fc 100644
--- a/frontend/src/metabase/querying/common/components/DatePicker/DatePicker.stories.tsx
+++ b/frontend/src/metabase/querying/common/components/DatePicker/DatePicker.stories.tsx
@@ -2,7 +2,7 @@ import type { Store } from "@reduxjs/toolkit";
import type { Meta, StoryFn } from "@storybook/react";
import { userEvent, within } from "@storybook/test";
import { merge } from "icepick";
-import { type ComponentProps, useEffect } from "react";
+import { type ComponentProps, type ComponentType, useEffect } from "react";
import { getPublicStore } from "__support__/entities-store";
import { mockSettings } from "__support__/settings";
@@ -22,7 +22,7 @@ const storeInitialState = createMockState({
// Unjustified type cast. FIXME
const store = getPublicStore(storeInitialState, []) as unknown as Store<State>;
-const ReduxDecorator = (Story: StoryFn) => {
+const ReduxDecorator = (Story: ComponentType) => {
return (
<MetabaseReduxProvider store={store}>
<Story />
@@ -49,7 +49,7 @@ const MockedDate: DateConstructor = new Proxy(OriginalDate, {
: Reflect.get(target, property, receiver),
});
-function WithMockDate(StoryFn: StoryFn) {
+function WithMockDate(StoryFn: ComponentType) {
window.Date = MockedDate;
useEffect(() => {
diff --git a/frontend/src/metabase/querying/components/DataReference/TableInfoLoader.tsx b/frontend/src/metabase/querying/components/DataReference/TableInfoLoader.tsx
new file mode 100644
index 00000000000..802e00b97e9
--- /dev/null
+++ b/frontend/src/metabase/querying/components/DataReference/TableInfoLoader.tsx
@@ -0,0 +1,72 @@
+import { type JSX, useEffect, useState } from "react";
+import { useAsyncFn } from "react-use";
+
+import { connect } from "metabase/redux";
+import type { Dispatch } from "metabase/redux/store";
+import {
+ fetchTableForeignKeys,
+ fetchTableMetadata,
+} from "metabase/redux/tables";
+import type Table from "metabase-lib/v1/metadata/Table";
+
+type OwnProps = {
+ table: Table;
+ children: JSX.Element[];
+};
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+ fetchForeignKeys: (args: { id: Table["id"] }) =>
+ dispatch(fetchTableForeignKeys(args)),
+ fetchMetadata: (args: { id: Table["id"] }) =>
+ dispatch(fetchTableMetadata(args)),
+});
+
+type AllProps = OwnProps & ReturnType<typeof mapDispatchToProps>;
+
+function useDependentTableMetadata({
+ table,
+ fetchForeignKeys,
+ fetchMetadata,
+}: Pick<AllProps, "table" | "fetchForeignKeys" | "fetchMetadata">) {
+ const isMissingFields = !table.numFields();
+ const isMissingFks = table.fks === undefined;
+ const shouldFetchMetadata = isMissingFields || isMissingFks;
+ const [hasFetchedMetadata, setHasFetchedMetadata] =
+ useState(!shouldFetchMetadata);
+ const tableId = table.id;
+ const [, fetchDependentData] = useAsyncFn(() => {
+ return Promise.all([
+ isMissingFields && fetchMetadata({ id: tableId }),
+ isMissingFks && fetchForeignKeys({ id: tableId }),
+ ]);
+ }, [fetchMetadata, tableId, isMissingFks, isMissingFields, fetchForeignKeys]);
+
+ useEffect(() => {
+ if (shouldFetchMetadata) {
+ fetchDependentData().then(() => {
+ setHasFetchedMetadata(true);
+ });
+ }
+ }, [fetchDependentData, shouldFetchMetadata]);
+
+ return hasFetchedMetadata;
+}
+
+export function TableInfoLoaderInner({
+ table,
+ fetchForeignKeys,
+ fetchMetadata,
+ children,
+}: AllProps): JSX.Element | null {
+ const hasFetchedMetadata = useDependentTableMetadata({
+ table,
+ fetchForeignKeys,
+ fetchMetadata,
+ });
+ return hasFetchedMetadata ? <> {children} </> : null;
+}
+
+export const TableInfoLoader = connect(
+ null,
+ mapDispatchToProps,
+)(TableInfoLoaderInner);
diff --git a/frontend/src/metabase/querying/components/NativeQueryEditor/NativeQueryEditorRoot.tsx b/frontend/src/metabase/querying/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
index d8d03ad302b..80ccc2db4d1 100644
--- a/frontend/src/metabase/querying/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
+++ b/frontend/src/metabase/querying/components/NativeQueryEditor/NativeQueryEditorRoot.tsx
@@ -2,6 +2,7 @@ import { useDebouncedCallback, useElementSize } from "@mantine/hooks";
import cx from "classnames";
import {
Children,
+ type ReactElement,
type ReactNode,
cloneElement,
forwardRef,
@@ -361,7 +362,10 @@ export const NativeQueryEditorRoot = forwardRef<
const bodySlots: ReactNode[] = [];
Children.toArray(children).forEach((child) => {
if (isValidElement(child) && child.type === TopBar) {
- topBar = cloneElement(child, { ref: topBarRef });
+ // TopBar forwards its ref; type the element so cloneElement accepts it.
+ topBar = cloneElement(child as ReactElement<{ ref?: typeof topBarRef }>, {
+ ref: topBarRef,
+ });
} else {
bodySlots.push(child);
}
diff --git a/frontend/src/metabase/querying/components/NativeQueryEditor/PreviewQueryButton/PreviewQueryButton.tsx b/frontend/src/metabase/querying/components/NativeQueryEditor/PreviewQueryButton/PreviewQueryButton.tsx
index 2099ef4b6c2..1ed280fa95b 100644
--- a/frontend/src/metabase/querying/components/NativeQueryEditor/PreviewQueryButton/PreviewQueryButton.tsx
+++ b/frontend/src/metabase/querying/components/NativeQueryEditor/PreviewQueryButton/PreviewQueryButton.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import type { QueryModalType } from "metabase/redux/store";
diff --git a/frontend/src/metabase/querying/components/expressions/Editor/Editor.tsx b/frontend/src/metabase/querying/components/expressions/Editor/Editor.tsx
index 7836bd8707b..97879fbd68f 100644
--- a/frontend/src/metabase/querying/components/expressions/Editor/Editor.tsx
+++ b/frontend/src/metabase/querying/components/expressions/Editor/Editor.tsx
@@ -2,7 +2,7 @@ import { EditorSelection, type EditorState } from "@codemirror/state";
import { useDisclosure } from "@mantine/hooks";
import type { ViewUpdate } from "@uiw/react-codemirror";
import cx from "classnames";
-import { useCallback, useMemo, useRef, useState } from "react";
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { useMount } from "react-use";
import { t } from "ttag";
import _ from "underscore";
@@ -363,20 +363,54 @@ function useExpression({
});
});
+ // Once the opened expression finishes formatting, validate it so the compiled
+ // clause reaches the widget and keeps the submit button enabled. We cannot
+ // wait for CodeMirror to report the formatted value as a change: that signal
+ // is unreliable under React 19's effect timing, which is what left the editor
+ // looking populated while the widget still had no clause.
+ const hasPropagatedInitialClause = useRef(false);
+ useEffect(() => {
+ if (isFormatting || hasPropagatedInitialClause.current) {
+ return;
+ }
+ // Formatting has settled, so the initial clause (if any) is now in `source`.
+ // Mark it handled whether or not it had content, otherwise an editor that
+ // opened empty would treat the user's first keystroke as the initial clause
+ // and validate it at once, defeating the debounce on every later keystroke.
+ hasPropagatedInitialClause.current = true;
+ if (source.trim() !== "") {
+ handleUpdate(source, true);
+ }
+ }, [isFormatting, source, handleUpdate]);
+
const handleSourceChange = useCallback(
(source: string) => {
+ // While the initial expression is still being formatted the editor holds
+ // the transient empty document, and CodeMirror reports that as a change.
+ // Treating it as a user edit emits `onChange(null)` and clears the valid
+ // clause the widget opened with, which React 19's effect timing lets race
+ // ahead of the formatted value landing. Ignore changes until formatting
+ // settles; real edits only happen afterwards.
+ if (isFormatting) {
+ return;
+ }
handleUpdate(source, false);
},
- [handleUpdate],
+ [handleUpdate, isFormatting],
);
const handleBlur = useCallback(() => {
- // `source` is stale until formatting settles; updating now would overwrite the formatted result
- if (isFormatting) {
+ // `source` is stale until formatting settles; updating now would overwrite
+ // the formatted result. Blur also fires when focus leaves for the
+ // aggregation name field: until the user edits the expression the opened
+ // clause still stands, so an unedited source (which under React 19 can be
+ // the empty document a failed initial format left behind) must not
+ // propagate and clear that clause.
+ if (isFormatting || source === initialSource) {
return;
}
handleUpdate(source, true);
- }, [handleUpdate, source, isFormatting]);
+ }, [handleUpdate, source, initialSource, isFormatting]);
const handleFormatExpression = useCallback(() => {
formatExpression({ initial: false });
diff --git a/frontend/src/metabase/querying/components/expressions/Editor/Tooltip/Tooltip.tsx b/frontend/src/metabase/querying/components/expressions/Editor/Tooltip/Tooltip.tsx
index c28a7e698f2..98dad156a1a 100644
--- a/frontend/src/metabase/querying/components/expressions/Editor/Tooltip/Tooltip.tsx
+++ b/frontend/src/metabase/querying/components/expressions/Editor/Tooltip/Tooltip.tsx
@@ -36,7 +36,7 @@ export function Tooltip({
expressionMode: Lib.ExpressionMode;
// from tooltip extension
- tooltipRef: RefObject<HTMLDivElement>;
+ tooltipRef: RefObject<HTMLDivElement | null>;
state: EditorState;
view: EditorView;
}) {
diff --git a/frontend/src/metabase/querying/components/expressions/Editor/custom-tooltip.tsx b/frontend/src/metabase/querying/components/expressions/Editor/custom-tooltip.tsx
index 245d1820963..1f852de7f76 100644
--- a/frontend/src/metabase/querying/components/expressions/Editor/custom-tooltip.tsx
+++ b/frontend/src/metabase/querying/components/expressions/Editor/custom-tooltip.tsx
@@ -24,7 +24,7 @@ import { createPortal } from "react-dom";
type TooltipProps = {
state: EditorState;
view: EditorView;
- tooltipRef: RefObject<HTMLDivElement>;
+ tooltipRef: RefObject<HTMLDivElement | null>;
};
type TooltipOptions = {
diff --git a/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidget.unit.spec.tsx b/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidget.unit.spec.tsx
index 1aafa699e7b..6b5e4d4dd97 100644
--- a/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidget.unit.spec.tsx
+++ b/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidget.unit.spec.tsx
@@ -151,6 +151,22 @@ describe("ExpressionWidget", () => {
});
});
+ it("debounces the first validation of a new expression", async () => {
+ await setup({ expressionMode: "aggregation" });
+
+ await userEvent.paste("[Imaginary]");
+
+ // Validation is debounced, so the error must not appear synchronously with
+ // the first change to a new expression.
+ expect(
+ screen.queryByText("Unknown Aggregation, Measure or Metric: Imaginary"),
+ ).not.toBeInTheDocument();
+
+ await screen.findByText(
+ "Unknown Aggregation, Measure or Metric: Imaginary",
+ );
+ });
+
describe("expressionMode = 'expression'", () => {
it("should show a detailed error when comma is missing (metabase#15892)", async () => {
await setup({ expressionMode: "expression" });
diff --git a/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidgetHeader.tsx b/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidgetHeader.tsx
index c7ca29be2d8..e2580cd324c 100644
--- a/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidgetHeader.tsx
+++ b/frontend/src/metabase/querying/components/expressions/ExpressionWidget/ExpressionWidgetHeader.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { Button, Flex, Icon } from "metabase/ui";
diff --git a/frontend/src/metabase/querying/editor/hooks/use-query-results/use-query-results.ts b/frontend/src/metabase/querying/editor/hooks/use-query-results/use-query-results.ts
index a67e561c71d..611d041feae 100644
--- a/frontend/src/metabase/querying/editor/hooks/use-query-results/use-query-results.ts
+++ b/frontend/src/metabase/querying/editor/hooks/use-query-results/use-query-results.ts
@@ -18,7 +18,7 @@ export function useQueryResults(
const { lastRunResult, lastRunQuery } = uiState;
const [runAdhocQuery, { isFetching: isRunning = false }] =
useLazyGetAdhocQueryQuery();
- const abortRef = useRef<() => void>();
+ const abortRef = useRef<() => void>(undefined);
const { rawSeries, isRunnable, isResultDirty } = useMemo(() => {
// Read only for its card and its legacy query, so it needs no metadata.
diff --git a/frontend/src/metabase/querying/notebook/components/ClauseStep/ClausePopover.tsx b/frontend/src/metabase/querying/notebook/components/ClauseStep/ClausePopover.tsx
index 8338532d241..0fbf11c1782 100644
--- a/frontend/src/metabase/querying/notebook/components/ClauseStep/ClausePopover.tsx
+++ b/frontend/src/metabase/querying/notebook/components/ClauseStep/ClausePopover.tsx
@@ -1,5 +1,5 @@
import { useDndContext } from "@dnd-kit/core";
-import { useCallback, useLayoutEffect, useState } from "react";
+import { type JSX, useCallback, useLayoutEffect, useState } from "react";
import { Box, Popover } from "metabase/ui";
import { PreventPopoverExitProvider } from "metabase/ui/components/utils/PreventPopoverExit";
diff --git a/frontend/src/metabase/querying/notebook/components/ClauseStep/ClauseStep.tsx b/frontend/src/metabase/querying/notebook/components/ClauseStep/ClauseStep.tsx
index b2284477fd8..978335af688 100644
--- a/frontend/src/metabase/querying/notebook/components/ClauseStep/ClauseStep.tsx
+++ b/frontend/src/metabase/querying/notebook/components/ClauseStep/ClauseStep.tsx
@@ -7,7 +7,7 @@ import { restrictToParentElement } from "@dnd-kit/modifiers";
import { SortableContext, useSortable } from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { useMergedRef } from "@mantine/hooks";
-import type { ReactNode, Ref } from "react";
+import type { JSX, ReactNode, Ref } from "react";
import { forwardRef, useCallback } from "react";
import { useDndSensors } from "metabase/common/hooks";
diff --git a/frontend/src/metabase/querying/notebook/components/ExpressionStep/ExpressionStep.tsx b/frontend/src/metabase/querying/notebook/components/ExpressionStep/ExpressionStep.tsx
index 5c89ce04189..47ea69ab463 100644
--- a/frontend/src/metabase/querying/notebook/components/ExpressionStep/ExpressionStep.tsx
+++ b/frontend/src/metabase/querying/notebook/components/ExpressionStep/ExpressionStep.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { useTranslateContent } from "metabase/content-translation/hooks";
import * as Lib from "metabase-lib";
diff --git a/frontend/src/metabase/redux/store/undo.ts b/frontend/src/metabase/redux/store/undo.ts
index 544476a0915..526621f3462 100644
--- a/frontend/src/metabase/redux/store/undo.ts
+++ b/frontend/src/metabase/redux/store/undo.ts
@@ -38,7 +38,7 @@ export interface Undo {
label: string;
action: () => void;
};
- ref?: RefObject<HTMLDivElement>;
+ ref?: RefObject<HTMLDivElement | null>;
renderChildren?: (undo: Undo) => ReactNode;
onDismiss?: (undoId: string | number) => void;
}
diff --git a/frontend/src/metabase/reference/components/SidebarLayout/SidebarLayout.tsx b/frontend/src/metabase/reference/components/SidebarLayout/SidebarLayout.tsx
index 7ee92a47cb7..bf478a9cf9b 100644
--- a/frontend/src/metabase/reference/components/SidebarLayout/SidebarLayout.tsx
+++ b/frontend/src/metabase/reference/components/SidebarLayout/SidebarLayout.tsx
@@ -1,14 +1,20 @@
import cx from "classnames";
-import type { CSSProperties, ReactElement } from "react";
+import type { CSSProperties, ReactElement, ReactNode } from "react";
import { Children, cloneElement } from "react";
import CS from "metabase/css/core/index.css";
+type LayoutChild = ReactElement<{
+ children?: ReactNode;
+ style?: CSSProperties;
+ className?: string;
+}>;
+
interface SidebarLayoutProps {
className?: string;
style?: CSSProperties;
- sidebar: ReactElement;
- children: ReactElement;
+ sidebar: LayoutChild;
+ children: LayoutChild;
}
export const SidebarLayout = ({
diff --git a/frontend/src/metabase/rich_text_editing/tiptap/extensions/Command/CommandSuggestion.tsx b/frontend/src/metabase/rich_text_editing/tiptap/extensions/Command/CommandSuggestion.tsx
index b654156bc7b..d9858c21813 100644
--- a/frontend/src/metabase/rich_text_editing/tiptap/extensions/Command/CommandSuggestion.tsx
+++ b/frontend/src/metabase/rich_text_editing/tiptap/extensions/Command/CommandSuggestion.tsx
@@ -460,7 +460,9 @@ export const CommandSuggestion = forwardRef<
return (
<CommandMenuItem
key={`cmd-${cmdIndex}`}
- ref={(el) => (itemRefs.current[index] = el)}
+ ref={(el) => {
+ itemRefs.current[index] = el;
+ }}
option={option}
isSelected={selectedIndex === index}
onClick={() => selectItem(index)}
@@ -500,7 +502,9 @@ export const CommandSuggestion = forwardRef<
return (
<CommandMenuItem
key={index}
- ref={(el) => (itemRefs.current[index] = el)}
+ ref={(el) => {
+ itemRefs.current[index] = el;
+ }}
option={option}
isSelected={selectedIndex === index}
onClick={() => selectItem(index)}
diff --git a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/ExternalMenuTarget.tsx b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/ExternalMenuTarget.tsx
index a05cdb79149..b0299be9889 100644
--- a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/ExternalMenuTarget.tsx
+++ b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/ExternalMenuTarget.tsx
@@ -14,7 +14,9 @@ export const ExternalMenuTarget = forwardRef<
Element | null,
ExternalMenuTargetProps
>(function ExternalMenuTarget({ element }, ref) {
- useImperativeHandle(ref, () => element, [element]);
+ useImperativeHandle<Element | null, Element | null>(ref, () => element, [
+ element,
+ ]);
return null;
});
diff --git a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/dnd/use-dnd-helpers.ts b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/dnd/use-dnd-helpers.ts
index 83558c0379e..5116ab1a031 100644
--- a/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/dnd/use-dnd-helpers.ts
+++ b/frontend/src/metabase/rich_text_editing/tiptap/extensions/shared/dnd/use-dnd-helpers.ts
@@ -17,7 +17,7 @@ export const useDndHelpers = ({
isDraggedOver: boolean;
side: "left" | "right" | null;
}>({ isDraggedOver: false, side: null });
- const draggedOverTimeoutRef = useRef<number | undefined>();
+ const draggedOverTimeoutRef = useRef<number | undefined>(undefined);
const dragElRef = useRef<HTMLDivElement | null>(null);
const isMountedRef = useRef(false);
diff --git a/frontend/src/metabase/router/AppShell.tsx b/frontend/src/metabase/router/AppShell.tsx
index 3ef086ce528..80a2283b8ea 100644
--- a/frontend/src/metabase/router/AppShell.tsx
+++ b/frontend/src/metabase/router/AppShell.tsx
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { Outlet, useNavigate } from "react-router";
import { setRouterNavigate } from "./navigator";
diff --git a/frontend/src/metabase/router/RouterProvider.tsx b/frontend/src/metabase/router/RouterProvider.tsx
index 6eba6a4bad9..e41847b4016 100644
--- a/frontend/src/metabase/router/RouterProvider.tsx
+++ b/frontend/src/metabase/router/RouterProvider.tsx
@@ -1,4 +1,4 @@
-import { type ReactNode, useLayoutEffect, useState } from "react";
+import { type JSX, type ReactNode, useLayoutEffect, useState } from "react";
import {
type DataRouter,
RouterProvider as ReactRouterProvider,
diff --git a/frontend/src/metabase/router/index.ts b/frontend/src/metabase/router/index.ts
index ad7792b8963..2b2e3d9c061 100644
--- a/frontend/src/metabase/router/index.ts
+++ b/frontend/src/metabase/router/index.ts
@@ -33,6 +33,7 @@ export { queryToSearch, toFacadeLocation } from "./location";
export { createLocationMirror, type LocationMirror } from "./location-mirror";
export {
getIsNavigationPending,
+ getPendingNavigationPath,
getRouterLocation,
navigate,
notifyLocationListeners,
diff --git a/frontend/src/metabase/router/lazy-route.unit.spec.tsx b/frontend/src/metabase/router/lazy-route.unit.spec.tsx
index 2ae847b0293..46a3b7c448a 100644
--- a/frontend/src/metabase/router/lazy-route.unit.spec.tsx
+++ b/frontend/src/metabase/router/lazy-route.unit.spec.tsx
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { act, render, renderRoutes, screen } from "__support__/ui";
import {
diff --git a/frontend/src/metabase/router/navigator.ts b/frontend/src/metabase/router/navigator.ts
index 368c7d79bfa..d96536e564b 100644
--- a/frontend/src/metabase/router/navigator.ts
+++ b/frontend/src/metabase/router/navigator.ts
@@ -56,6 +56,21 @@ export function setRouter(router: DataRouter | null): void {
currentRouter = router;
}
+/**
+ * Clears every module-level router holder. These outlive a single React tree,
+ * so without a reset one test leaks router state into the next: a test that
+ * never mounts a router can queue a navigation (because `isRouterExpected`
+ * stayed true from an earlier test) that the next test's router then flushes.
+ * The jest harness calls this after each test.
+ */
+export function resetRouterForTests(): void {
+ currentNavigate = null;
+ pendingNavigations = [];
+ isRouterExpected = false;
+ currentRouter = null;
+ locationListeners.clear();
+}
+
/**
* Whether the router has accepted a navigation it has not committed yet.
*
@@ -84,6 +99,21 @@ export function getIsNavigationPending(): boolean {
export const getRouterLocation = (): Location | undefined =>
currentRouter?.state.location;
+/**
+ * The pathname of the navigation the router has accepted but not committed, or
+ * null when none is pending.
+ *
+ * Callers that only want to avoid clobbering a navigation to a *different*
+ * destination need the target, not just whether one is pending: a pending
+ * navigation to the same path they are about to write is theirs to keep, not a
+ * redirect to sit out. Under React 19 the pending window stays open across the
+ * lazy chunk load a render longer, so a blanket "is anything pending" check
+ * drops legitimate same-destination URL syncs.
+ */
+export function getPendingNavigationPath(): string | null {
+ return currentRouter?.state.navigation.location?.pathname ?? null;
+}
+
export function setRouterNavigate(navigate: NavigateFunction | null): void {
currentNavigate = navigate;
if (!navigate) {
diff --git a/frontend/src/metabase/router/redirect.tsx b/frontend/src/metabase/router/redirect.tsx
index b5f54262010..cc8163d2694 100644
--- a/frontend/src/metabase/router/redirect.tsx
+++ b/frontend/src/metabase/router/redirect.tsx
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { type JSX, useState } from "react";
import { Navigate, generatePath, useLocation, useParams } from "react-router";
function RedirectRoute({ to }: { to: string }): JSX.Element {
diff --git a/frontend/src/metabase/router/redirect.unit.spec.tsx b/frontend/src/metabase/router/redirect.unit.spec.tsx
index 00f352ab6f1..a129adcbe27 100644
--- a/frontend/src/metabase/router/redirect.unit.spec.tsx
+++ b/frontend/src/metabase/router/redirect.unit.spec.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { renderWithProviders, screen, waitFor } from "__support__/ui";
import { Outlet, Route } from "metabase/router";
diff --git a/frontend/src/metabase/router/route-leave-guards.tsx b/frontend/src/metabase/router/route-leave-guards.tsx
index 58f56d4e82d..b708cc88898 100644
--- a/frontend/src/metabase/router/route-leave-guards.tsx
+++ b/frontend/src/metabase/router/route-leave-guards.tsx
@@ -1,4 +1,4 @@
-import type { PropsWithChildren, RefObject } from "react";
+import type { JSX, PropsWithChildren, RefObject } from "react";
import {
createContext,
useCallback,
diff --git a/frontend/src/metabase/router/use-route-leave-blocker.unit.spec.tsx b/frontend/src/metabase/router/use-route-leave-blocker.unit.spec.tsx
index 4447258e791..3d91948a43b 100644
--- a/frontend/src/metabase/router/use-route-leave-blocker.unit.spec.tsx
+++ b/frontend/src/metabase/router/use-route-leave-blocker.unit.spec.tsx
@@ -1,5 +1,5 @@
import userEvent from "@testing-library/user-event";
-import { type PropsWithChildren, useLayoutEffect } from "react";
+import { type JSX, type PropsWithChildren, useLayoutEffect } from "react";
import { act, renderWithProviders, screen } from "__support__/ui";
import { Navigate, Route, useNavigate } from "metabase/router";
diff --git a/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx b/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx
index 8795736e23b..4b54cdb8ab0 100644
--- a/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx
+++ b/frontend/src/metabase/setup/components/ActiveStep/ActiveStep.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useSelector } from "metabase/redux";
import { getShouldShowStepNumber } from "metabase/setup";
diff --git a/frontend/src/metabase/setup/components/CompletedStep/CompletedStep.tsx b/frontend/src/metabase/setup/components/CompletedStep/CompletedStep.tsx
index f6d00cdaece..84b735dec5d 100644
--- a/frontend/src/metabase/setup/components/CompletedStep/CompletedStep.tsx
+++ b/frontend/src/metabase/setup/components/CompletedStep/CompletedStep.tsx
@@ -1,4 +1,4 @@
-import { type ChangeEvent, useState } from "react";
+import { type ChangeEvent, type JSX, useState } from "react";
import { t } from "ttag";
import { useDispatch, useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/setup/components/DataUsageStep/DataUsageStep.tsx b/frontend/src/metabase/setup/components/DataUsageStep/DataUsageStep.tsx
index 13807a6da0a..609e2060141 100644
--- a/frontend/src/metabase/setup/components/DataUsageStep/DataUsageStep.tsx
+++ b/frontend/src/metabase/setup/components/DataUsageStep/DataUsageStep.tsx
@@ -1,5 +1,5 @@
import { getIn } from "icepick";
-import { useState } from "react";
+import { type JSX, useState } from "react";
import { jt, t } from "ttag";
import { ActionButton } from "metabase/common/components/ActionButton";
diff --git a/frontend/src/metabase/setup/components/DatabaseHelp/DatabaseHelp.tsx b/frontend/src/metabase/setup/components/DatabaseHelp/DatabaseHelp.tsx
index 6c1bd43db11..d5a79f422aa 100644
--- a/frontend/src/metabase/setup/components/DatabaseHelp/DatabaseHelp.tsx
+++ b/frontend/src/metabase/setup/components/DatabaseHelp/DatabaseHelp.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { DatabaseHelpCard } from "metabase/databases/components/DatabaseHelpCard";
import { useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/setup/components/DatabaseStep/DatabaseStep.tsx b/frontend/src/metabase/setup/components/DatabaseStep/DatabaseStep.tsx
index e477f039981..bed03179cc8 100644
--- a/frontend/src/metabase/setup/components/DatabaseStep/DatabaseStep.tsx
+++ b/frontend/src/metabase/setup/components/DatabaseStep/DatabaseStep.tsx
@@ -1,4 +1,5 @@
import { updateIn } from "icepick";
+import type { JSX } from "react";
import { c, t } from "ttag";
import { useToast } from "metabase/common/hooks";
diff --git a/frontend/src/metabase/setup/components/InactiveStep/InactiveStep.tsx b/frontend/src/metabase/setup/components/InactiveStep/InactiveStep.tsx
index 14a6b702d19..6faa70eadfb 100644
--- a/frontend/src/metabase/setup/components/InactiveStep/InactiveStep.tsx
+++ b/frontend/src/metabase/setup/components/InactiveStep/InactiveStep.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import { Box, Center, Icon } from "metabase/ui";
diff --git a/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx b/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
index ce744d0d505..e86549b4714 100644
--- a/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
+++ b/frontend/src/metabase/setup/components/InviteUserForm/InviteUserForm.tsx
@@ -1,4 +1,4 @@
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/setup/components/LanguageStep/LanguageStep.tsx b/frontend/src/metabase/setup/components/LanguageStep/LanguageStep.tsx
index 4c2cf4db50f..5645c5b68de 100644
--- a/frontend/src/metabase/setup/components/LanguageStep/LanguageStep.tsx
+++ b/frontend/src/metabase/setup/components/LanguageStep/LanguageStep.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useCallback, useMemo, useState } from "react";
+import { type JSX, useCallback, useMemo, useState } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/setup/components/SettingsPage/SettingsPage.tsx b/frontend/src/metabase/setup/components/SettingsPage/SettingsPage.tsx
index 44611575a5b..4ec9ff585ba 100644
--- a/frontend/src/metabase/setup/components/SettingsPage/SettingsPage.tsx
+++ b/frontend/src/metabase/setup/components/SettingsPage/SettingsPage.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { getLocalizationNoticeText } from "metabase/common/components/CommunityLocalizationNotice";
import { LogoIcon } from "metabase/common/components/LogoIcon";
import { useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/setup/components/Setup/Setup.tsx b/frontend/src/metabase/setup/components/Setup/Setup.tsx
index 89e3f8f7ef4..16b5191f236 100644
--- a/frontend/src/metabase/setup/components/Setup/Setup.tsx
+++ b/frontend/src/metabase/setup/components/Setup/Setup.tsx
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { useUpdate } from "react-use";
import { useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/setup/components/SetupHelp/SetupHelp.tsx b/frontend/src/metabase/setup/components/SetupHelp/SetupHelp.tsx
index 3b991ccf693..9f9b7fb55f8 100644
--- a/frontend/src/metabase/setup/components/SetupHelp/SetupHelp.tsx
+++ b/frontend/src/metabase/setup/components/SetupHelp/SetupHelp.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { ExternalLink } from "metabase/common/components/ExternalLink";
diff --git a/frontend/src/metabase/setup/components/SetupSection/SetupSection.tsx b/frontend/src/metabase/setup/components/SetupSection/SetupSection.tsx
index 14f50c5e7e5..5552deb04b8 100644
--- a/frontend/src/metabase/setup/components/SetupSection/SetupSection.tsx
+++ b/frontend/src/metabase/setup/components/SetupSection/SetupSection.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { useState } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/setup/components/UserStep/UserStep.tsx b/frontend/src/metabase/setup/components/UserStep/UserStep.tsx
index c8d0d0627ad..a25425d260a 100644
--- a/frontend/src/metabase/setup/components/UserStep/UserStep.tsx
+++ b/frontend/src/metabase/setup/components/UserStep/UserStep.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { useDispatch, useSelector } from "metabase/redux";
diff --git a/frontend/src/metabase/setup/components/WelcomePage/WelcomePage.tsx b/frontend/src/metabase/setup/components/WelcomePage/WelcomePage.tsx
index 887ba0dade0..05ec526ac79 100644
--- a/frontend/src/metabase/setup/components/WelcomePage/WelcomePage.tsx
+++ b/frontend/src/metabase/setup/components/WelcomePage/WelcomePage.tsx
@@ -1,4 +1,4 @@
-import { useEffect } from "react";
+import { type JSX, useEffect } from "react";
import { useTimeout } from "react-use";
import { t } from "ttag";
diff --git a/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx b/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
index fee5872df7b..ee1e76aabac 100644
--- a/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
+++ b/frontend/src/metabase/static-viz/components/StaticVisualization/StaticVisualization.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { registerStaticVisualizations } from "metabase/static-viz/register";
import {
type StaticVisualizationProps,
diff --git a/frontend/src/metabase/static-viz/polyfill.ts b/frontend/src/metabase/static-viz/polyfill.ts
index 6d1118e2d24..12e2d8e44cf 100644
--- a/frontend/src/metabase/static-viz/polyfill.ts
+++ b/frontend/src/metabase/static-viz/polyfill.ts
@@ -148,6 +148,24 @@ defineGlobal("clearInterval", () => {});
defineGlobal("requestAnimationFrame", () => {});
defineGlobal("cancelAnimationFrame", () => {});
+// React 19's scheduler references MessageChannel to post async work. This
+// environment renders synchronously (setTimeout above is a no-op), so the
+// ports are no-ops too. Without this global the bundle throws
+// "ReferenceError: MessageChannel is not defined" while rendering.
+class MockMessagePort {
+ onmessage: unknown = null;
+ postMessage(): void {}
+ start(): void {}
+ close(): void {}
+ addEventListener(): void {}
+ removeEventListener(): void {}
+}
+class MockMessageChannel {
+ port1 = new MockMessagePort();
+ port2 = new MockMessagePort();
+}
+defineGlobal("MessageChannel", MockMessageChannel);
+
const createMockEvent = (type: string) => ({
type,
bubbles: false,
diff --git a/frontend/src/metabase/status/components/DatabaseStatus/DatabaseStatus.tsx b/frontend/src/metabase/status/components/DatabaseStatus/DatabaseStatus.tsx
index 7252be58caf..0802a44f9d0 100644
--- a/frontend/src/metabase/status/components/DatabaseStatus/DatabaseStatus.tsx
+++ b/frontend/src/metabase/status/components/DatabaseStatus/DatabaseStatus.tsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from "react";
+import { type JSX, useEffect, useState } from "react";
import { useListDatabasesQuery } from "metabase/api";
import { getUser } from "metabase/current-user";
diff --git a/frontend/src/metabase/status/components/DownloadsStatus/DownloadsStatus.tsx b/frontend/src/metabase/status/components/DownloadsStatus/DownloadsStatus.tsx
index d4b9b3f9f6b..d9284279098 100644
--- a/frontend/src/metabase/status/components/DownloadsStatus/DownloadsStatus.tsx
+++ b/frontend/src/metabase/status/components/DownloadsStatus/DownloadsStatus.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useEffect, useState } from "react";
+import { type JSX, useCallback, useEffect, useState } from "react";
import { useDispatch, useSelector } from "metabase/redux";
import { clearAll, getDownloads } from "metabase/redux/downloads";
diff --git a/frontend/src/metabase/status/components/DownloadsStatusSmall/DownloadsStatusSmall.tsx b/frontend/src/metabase/status/components/DownloadsStatusSmall/DownloadsStatusSmall.tsx
index 864c49329b4..994839a36fb 100644
--- a/frontend/src/metabase/status/components/DownloadsStatusSmall/DownloadsStatusSmall.tsx
+++ b/frontend/src/metabase/status/components/DownloadsStatusSmall/DownloadsStatusSmall.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import type { Download } from "metabase/redux/store";
diff --git a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
index bb9af4e73e8..bd1040a3a44 100644
--- a/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
+++ b/frontend/src/metabase/status/components/StatusLarge/StatusLarge.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { PropsWithChildren } from "react";
+import type { JSX, PropsWithChildren } from "react";
import { t } from "ttag";
import { Link } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
index 66e6e14caaa..3b2e0f96745 100644
--- a/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
+++ b/frontend/src/metabase/status/components/StatusSmall/StatusSmall.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Flex, Icon, Loader, Tooltip, UnstyledButton } from "metabase/ui";
import type { IconName, InitialSyncStatus } from "metabase-types/api";
diff --git a/frontend/src/metabase/styled-components/containers/GlobalStyles/GlobalStyles.tsx b/frontend/src/metabase/styled-components/containers/GlobalStyles/GlobalStyles.tsx
index ce8832655d7..2eb504a0074 100644
--- a/frontend/src/metabase/styled-components/containers/GlobalStyles/GlobalStyles.tsx
+++ b/frontend/src/metabase/styled-components/containers/GlobalStyles/GlobalStyles.tsx
@@ -1,6 +1,6 @@
// eslint-disable-next-line eslint-js/no-restricted-imports
import { Global, css } from "@emotion/react";
-import { useMemo } from "react";
+import { type JSX, useMemo } from "react";
import { baseStyle, rootStyle } from "metabase/css/core/base.styled";
import { defaultFontFiles } from "metabase/css/core/fonts.styled";
diff --git a/frontend/src/metabase/timelines/collections/components/EventCard/EventCard.tsx b/frontend/src/metabase/timelines/collections/components/EventCard/EventCard.tsx
index 10b01580aad..19e9eebb3f0 100644
--- a/frontend/src/metabase/timelines/collections/components/EventCard/EventCard.tsx
+++ b/frontend/src/metabase/timelines/collections/components/EventCard/EventCard.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { memo } from "react";
+import { type JSX, memo } from "react";
import { t } from "ttag";
import { ForwardRefLink, Link } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/timelines/collections/components/EventList/EventList.tsx b/frontend/src/metabase/timelines/collections/components/EventList/EventList.tsx
index 30e25bff486..45d24ab6d56 100644
--- a/frontend/src/metabase/timelines/collections/components/EventList/EventList.tsx
+++ b/frontend/src/metabase/timelines/collections/components/EventList/EventList.tsx
@@ -1,4 +1,4 @@
-import { memo } from "react";
+import { type JSX, memo } from "react";
import { t } from "ttag";
import { Box, Flex, Icon, Stack, Text } from "metabase/ui";
diff --git a/frontend/src/metabase/timelines/collections/components/SearchEmptyState/SearchEmptyState.tsx b/frontend/src/metabase/timelines/collections/components/SearchEmptyState/SearchEmptyState.tsx
index 98f9900b7d4..aa49e1947c7 100644
--- a/frontend/src/metabase/timelines/collections/components/SearchEmptyState/SearchEmptyState.tsx
+++ b/frontend/src/metabase/timelines/collections/components/SearchEmptyState/SearchEmptyState.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import EmptyFolder from "assets/img/empty-states/collection.svg";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineCard/TimelineCard.tsx b/frontend/src/metabase/timelines/collections/components/TimelineCard/TimelineCard.tsx
index 52d44c8b281..558e3a53fa9 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineCard/TimelineCard.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineCard/TimelineCard.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { memo } from "react";
+import { type JSX, memo } from "react";
import { msgid, ngettext, t } from "ttag";
import { ForwardRefLink, Link } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineDetailsModal/TimelineDetailsModal.tsx b/frontend/src/metabase/timelines/collections/components/TimelineDetailsModal/TimelineDetailsModal.tsx
index f20b2785aec..dfc402c8ecd 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineDetailsModal/TimelineDetailsModal.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineDetailsModal/TimelineDetailsModal.tsx
@@ -1,4 +1,10 @@
-import { type ChangeEventHandler, useCallback, useMemo, useState } from "react";
+import {
+ type ChangeEventHandler,
+ type JSX,
+ useCallback,
+ useMemo,
+ useState,
+} from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineEmptyState/TimelineEmptyState.tsx b/frontend/src/metabase/timelines/collections/components/TimelineEmptyState/TimelineEmptyState.tsx
index 0468ce951e6..7113d85845b 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineEmptyState/TimelineEmptyState.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineEmptyState/TimelineEmptyState.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { c, t } from "ttag";
import EmptyEvent from "assets/img/empty-states/event.svg";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineIndexModal/TimelineIndexModal.tsx b/frontend/src/metabase/timelines/collections/components/TimelineIndexModal/TimelineIndexModal.tsx
index 9efa63c33a2..79a06db5467 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineIndexModal/TimelineIndexModal.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineIndexModal/TimelineIndexModal.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { Timeline } from "metabase-types/api";
import TimelineDetailsModal from "../../containers/TimelineDetailsModal";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineList/TimelineList.tsx b/frontend/src/metabase/timelines/collections/components/TimelineList/TimelineList.tsx
index 30b67485c4e..582f11b9cad 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineList/TimelineList.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineList/TimelineList.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { Timeline } from "metabase-types/api";
import TimelineCard from "../TimelineCard";
diff --git a/frontend/src/metabase/timelines/collections/components/TimelineListModal/TimelineListModal.tsx b/frontend/src/metabase/timelines/collections/components/TimelineListModal/TimelineListModal.tsx
index 3310543077e..1c8960525e1 100644
--- a/frontend/src/metabase/timelines/collections/components/TimelineListModal/TimelineListModal.tsx
+++ b/frontend/src/metabase/timelines/collections/components/TimelineListModal/TimelineListModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import { ForwardRefLink } from "metabase/common/components/Link";
diff --git a/frontend/src/metabase/timelines/common/components/DeleteEventModal/DeleteEventModal.tsx b/frontend/src/metabase/timelines/common/components/DeleteEventModal/DeleteEventModal.tsx
index 221ec140b5c..7fbb6f702c9 100644
--- a/frontend/src/metabase/timelines/common/components/DeleteEventModal/DeleteEventModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/DeleteEventModal/DeleteEventModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { Button } from "metabase/ui";
diff --git a/frontend/src/metabase/timelines/common/components/DeleteTimelineModal/DeleteTimelineModal.tsx b/frontend/src/metabase/timelines/common/components/DeleteTimelineModal/DeleteTimelineModal.tsx
index 54336b7dc16..183152a595b 100644
--- a/frontend/src/metabase/timelines/common/components/DeleteTimelineModal/DeleteTimelineModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/DeleteTimelineModal/DeleteTimelineModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import { Button } from "metabase/ui";
diff --git a/frontend/src/metabase/timelines/common/components/EditEventModal/EditEventModal.tsx b/frontend/src/metabase/timelines/common/components/EditEventModal/EditEventModal.tsx
index 10a5dd43ebe..fe64cc2d366 100644
--- a/frontend/src/metabase/timelines/common/components/EditEventModal/EditEventModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/EditEventModal/EditEventModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import type {
diff --git a/frontend/src/metabase/timelines/common/components/EditTimelineModal/EditTimelineModal.tsx b/frontend/src/metabase/timelines/common/components/EditTimelineModal/EditTimelineModal.tsx
index 4a16b2a89e7..e6f3debbfe4 100644
--- a/frontend/src/metabase/timelines/common/components/EditTimelineModal/EditTimelineModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/EditTimelineModal/EditTimelineModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import type { Timeline, TimelineData } from "metabase-types/api";
diff --git a/frontend/src/metabase/timelines/common/components/EventForm/EventForm.tsx b/frontend/src/metabase/timelines/common/components/EventForm/EventForm.tsx
index 931f0afb361..65d1f83e38e 100644
--- a/frontend/src/metabase/timelines/common/components/EventForm/EventForm.tsx
+++ b/frontend/src/metabase/timelines/common/components/EventForm/EventForm.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import * as Yup from "yup";
diff --git a/frontend/src/metabase/timelines/common/components/FormArchiveButton/FormArchiveButton.tsx b/frontend/src/metabase/timelines/common/components/FormArchiveButton/FormArchiveButton.tsx
index 7ac2abc2dd3..fecab85e49d 100644
--- a/frontend/src/metabase/timelines/common/components/FormArchiveButton/FormArchiveButton.tsx
+++ b/frontend/src/metabase/timelines/common/components/FormArchiveButton/FormArchiveButton.tsx
@@ -1,4 +1,4 @@
-import type { MouseEvent, ReactNode } from "react";
+import type { JSX, MouseEvent, ReactNode } from "react";
import { Button } from "metabase/ui";
diff --git a/frontend/src/metabase/timelines/common/components/ModalBody/ModalBody.tsx b/frontend/src/metabase/timelines/common/components/ModalBody/ModalBody.tsx
index 738e9b09a2d..f22b9b5d0a6 100644
--- a/frontend/src/metabase/timelines/common/components/ModalBody/ModalBody.tsx
+++ b/frontend/src/metabase/timelines/common/components/ModalBody/ModalBody.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { Box } from "metabase/ui";
export interface ModalBodyProps {
diff --git a/frontend/src/metabase/timelines/common/components/ModalFooter/ModalFooter.tsx b/frontend/src/metabase/timelines/common/components/ModalFooter/ModalFooter.tsx
index a20d0499655..e74e422533d 100644
--- a/frontend/src/metabase/timelines/common/components/ModalFooter/ModalFooter.tsx
+++ b/frontend/src/metabase/timelines/common/components/ModalFooter/ModalFooter.tsx
@@ -1,4 +1,4 @@
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { Flex } from "metabase/ui";
diff --git a/frontend/src/metabase/timelines/common/components/ModalHeader/ModalHeader.tsx b/frontend/src/metabase/timelines/common/components/ModalHeader/ModalHeader.tsx
index d126044f48c..deeffcfd215 100644
--- a/frontend/src/metabase/timelines/common/components/ModalHeader/ModalHeader.tsx
+++ b/frontend/src/metabase/timelines/common/components/ModalHeader/ModalHeader.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ReactNode } from "react";
+import type { JSX, ReactNode } from "react";
import { c, t } from "ttag";
import CS from "metabase/css/core/index.css";
diff --git a/frontend/src/metabase/timelines/common/components/MoveEventModal/MoveEventModal.tsx b/frontend/src/metabase/timelines/common/components/MoveEventModal/MoveEventModal.tsx
index ad808cce17f..850917b9d69 100644
--- a/frontend/src/metabase/timelines/common/components/MoveEventModal/MoveEventModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/MoveEventModal/MoveEventModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo, useState } from "react";
+import { type JSX, useCallback, useMemo, useState } from "react";
import { t } from "ttag";
import { getSortedTimelines } from "metabase/common/utils/timelines";
diff --git a/frontend/src/metabase/timelines/common/components/MoveTimelineModal/MoveTimelineModal.tsx b/frontend/src/metabase/timelines/common/components/MoveTimelineModal/MoveTimelineModal.tsx
index cf489c2be39..dc7cd0c4cc4 100644
--- a/frontend/src/metabase/timelines/common/components/MoveTimelineModal/MoveTimelineModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/MoveTimelineModal/MoveTimelineModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { t } from "ttag";
import type { OmniPickerItem } from "metabase/common/components/Pickers";
diff --git a/frontend/src/metabase/timelines/common/components/NewEventModal/NewEventModal.tsx b/frontend/src/metabase/timelines/common/components/NewEventModal/NewEventModal.tsx
index 4c3b1d7282e..d3bbf0e8545 100644
--- a/frontend/src/metabase/timelines/common/components/NewEventModal/NewEventModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/NewEventModal/NewEventModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import { ModalContent } from "metabase/common/components/ModalContent";
diff --git a/frontend/src/metabase/timelines/common/components/NewTimelineModal/NewTimelineModal.tsx b/frontend/src/metabase/timelines/common/components/NewTimelineModal/NewTimelineModal.tsx
index 23784cba904..c94e28b8a8e 100644
--- a/frontend/src/metabase/timelines/common/components/NewTimelineModal/NewTimelineModal.tsx
+++ b/frontend/src/metabase/timelines/common/components/NewTimelineModal/NewTimelineModal.tsx
@@ -1,4 +1,4 @@
-import { useCallback, useMemo } from "react";
+import { type JSX, useCallback, useMemo } from "react";
import { t } from "ttag";
import { canonicalCollectionId } from "metabase/common/collections/utils";
diff --git a/frontend/src/metabase/timelines/common/components/TimelinePicker/TimelinePicker.tsx b/frontend/src/metabase/timelines/common/components/TimelinePicker/TimelinePicker.tsx
index 411d1f3603c..5a880b52256 100644
--- a/frontend/src/metabase/timelines/common/components/TimelinePicker/TimelinePicker.tsx
+++ b/frontend/src/metabase/timelines/common/components/TimelinePicker/TimelinePicker.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useCallback } from "react";
+import { type JSX, useCallback } from "react";
import { msgid, ngettext } from "ttag";
import { getEventCount } from "metabase/common/utils/timelines";
diff --git a/frontend/src/metabase/timelines/panel/components/EventCard/EventCard.tsx b/frontend/src/metabase/timelines/panel/components/EventCard/EventCard.tsx
index b95a6e3ff2b..150157f9b0c 100644
--- a/frontend/src/metabase/timelines/panel/components/EventCard/EventCard.tsx
+++ b/frontend/src/metabase/timelines/panel/components/EventCard/EventCard.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { ChangeEvent, SyntheticEvent } from "react";
+import type { ChangeEvent, JSX, SyntheticEvent } from "react";
import { memo, useCallback } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/timelines/panel/components/TimelineCard/TimelineCard.tsx b/frontend/src/metabase/timelines/panel/components/TimelineCard/TimelineCard.tsx
index 085c3f5c402..ee070629720 100644
--- a/frontend/src/metabase/timelines/panel/components/TimelineCard/TimelineCard.tsx
+++ b/frontend/src/metabase/timelines/panel/components/TimelineCard/TimelineCard.tsx
@@ -1,4 +1,4 @@
-import type { ChangeEvent, MouseEvent } from "react";
+import type { ChangeEvent, JSX, MouseEvent } from "react";
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/timelines/panel/components/TimelineEmptyState/TimelineEmptyState.tsx b/frontend/src/metabase/timelines/panel/components/TimelineEmptyState/TimelineEmptyState.tsx
index 510b2cc6e88..f393d039b24 100644
--- a/frontend/src/metabase/timelines/panel/components/TimelineEmptyState/TimelineEmptyState.tsx
+++ b/frontend/src/metabase/timelines/panel/components/TimelineEmptyState/TimelineEmptyState.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import EmptyEvent from "assets/img/empty-states/event.svg";
diff --git a/frontend/src/metabase/timelines/panel/components/TimelineList/TimelineList.tsx b/frontend/src/metabase/timelines/panel/components/TimelineList/TimelineList.tsx
index e6d2e36698d..49de854d9cd 100644
--- a/frontend/src/metabase/timelines/panel/components/TimelineList/TimelineList.tsx
+++ b/frontend/src/metabase/timelines/panel/components/TimelineList/TimelineList.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import type { Timeline, TimelineEvent } from "metabase-types/api";
import { TimelineCard } from "../TimelineCard/TimelineCard";
diff --git a/frontend/src/metabase/timelines/panel/components/TimelinePanel/TimelinePanel.tsx b/frontend/src/metabase/timelines/panel/components/TimelinePanel/TimelinePanel.tsx
index eac4b2d733c..5cc8e50575a 100644
--- a/frontend/src/metabase/timelines/panel/components/TimelinePanel/TimelinePanel.tsx
+++ b/frontend/src/metabase/timelines/panel/components/TimelinePanel/TimelinePanel.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { Box, Button } from "metabase/ui";
diff --git a/frontend/src/metabase/ui/components/data-display/TreeTable/TreeTableRow/TreeTableRow.tsx b/frontend/src/metabase/ui/components/data-display/TreeTable/TreeTableRow/TreeTableRow.tsx
index 5e6eb21a433..0eef3f4c513 100644
--- a/frontend/src/metabase/ui/components/data-display/TreeTable/TreeTableRow/TreeTableRow.tsx
+++ b/frontend/src/metabase/ui/components/data-display/TreeTable/TreeTableRow/TreeTableRow.tsx
@@ -1,7 +1,7 @@
import type { Row, Table } from "@tanstack/react-table";
import { flexRender } from "@tanstack/react-table";
import cx from "classnames";
-import type { MouseEvent } from "react";
+import type { JSX, MouseEvent } from "react";
import { memo, useMemo } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/ui/components/data-display/TreeTable/types.ts b/frontend/src/metabase/ui/components/data-display/TreeTable/types.ts
index c8e6fdee004..af781404d02 100644
--- a/frontend/src/metabase/ui/components/data-display/TreeTable/types.ts
+++ b/frontend/src/metabase/ui/components/data-display/TreeTable/types.ts
@@ -162,7 +162,7 @@ export interface TreeTableInstance<TData extends TreeNodeData> {
bottomPinnedRows: Row<TData>[];
virtualizer: Virtualizer<HTMLDivElement, Element>;
- containerRef: RefObject<HTMLDivElement>;
+ containerRef: RefObject<HTMLDivElement | null>;
virtualRows: VirtualItem[];
totalSize: number;
diff --git a/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts b/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts
index 138baafb936..8dab1a3df65 100644
--- a/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts
+++ b/frontend/src/metabase/ui/components/icons/Icon/icons/index.ts
@@ -309,7 +309,7 @@ import zap_component from "./zap.svg?component";
import zoom_in_component from "./zoom_in.svg?component";
import zoom_out_component from "./zoom_out.svg?component";
-export const Icons: Record<IconName, React.VFC> = {
+export const Icons: Record<IconName, React.FC> = {
add: add_component,
add_collection: add_collection_component,
add_column: add_column_component,
diff --git a/frontend/src/metabase/ui/components/utils/DelayGroup/DelayGroup.tsx b/frontend/src/metabase/ui/components/utils/DelayGroup/DelayGroup.tsx
index ffb6e40885e..652c4a06d88 100644
--- a/frontend/src/metabase/ui/components/utils/DelayGroup/DelayGroup.tsx
+++ b/frontend/src/metabase/ui/components/utils/DelayGroup/DelayGroup.tsx
@@ -32,7 +32,7 @@ export function DelayGroup({
}: DelayGroupProps) {
const [shouldDelay, setShouldDelay] = useState(true);
- const timeoutRef = useRef<number>();
+ const timeoutRef = useRef<number>(undefined);
const value = useMemo(
() => ({
diff --git a/frontend/src/metabase/ui/components/utils/PreventPopoverExit/PreventPopoverExit.tsx b/frontend/src/metabase/ui/components/utils/PreventPopoverExit/PreventPopoverExit.tsx
index bea2165c208..c8f851083dc 100644
--- a/frontend/src/metabase/ui/components/utils/PreventPopoverExit/PreventPopoverExit.tsx
+++ b/frontend/src/metabase/ui/components/utils/PreventPopoverExit/PreventPopoverExit.tsx
@@ -1,5 +1,6 @@
import {
Children,
+ type JSX,
cloneElement,
createContext,
useContext,
diff --git a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionControl.tsx b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionControl.tsx
index 373e5f195f0..4b8d5b4ffaf 100644
--- a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionControl.tsx
+++ b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionControl.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { useDispatch } from "metabase/redux";
import { Box, Button, Icon, Text, Tooltip } from "metabase/ui";
import {
diff --git a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsView.tsx b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsView.tsx
index 5c847dc99fb..a87b23ce56e 100644
--- a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsView.tsx
+++ b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsView.tsx
@@ -1,4 +1,4 @@
-import type { HTMLAttributes } from "react";
+import type { HTMLAttributes, JSX } from "react";
import { Divider, Stack } from "metabase/ui";
import { trackClickActionPerformed } from "metabase/visualizations/analytics";
diff --git a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsViewSection.tsx b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsViewSection.tsx
index 5b7b5ec280d..3ecd62afd56 100644
--- a/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsViewSection.tsx
+++ b/frontend/src/metabase/visualizations/components/ClickActions/ClickActionsViewSection.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Flex, Stack, Text, rem } from "metabase/ui";
import type { ContentDirectionType } from "./utils";
diff --git a/frontend/src/metabase/visualizations/components/EChartsRenderer/EChartsRenderer.tsx b/frontend/src/metabase/visualizations/components/EChartsRenderer/EChartsRenderer.tsx
index 2ca16f30772..c36527e4ea7 100644
--- a/frontend/src/metabase/visualizations/components/EChartsRenderer/EChartsRenderer.tsx
+++ b/frontend/src/metabase/visualizations/components/EChartsRenderer/EChartsRenderer.tsx
@@ -39,7 +39,7 @@ export const EChartsRenderer = forwardRef<HTMLDivElement, EChartsRendererProps>(
ref,
) {
const chartElemRef = useRef<HTMLDivElement>(null);
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
useMount(() => {
chartRef.current = init(chartElemRef.current, null, {
diff --git a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailBody.tsx b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailBody.tsx
index 9315bca19b9..f0ca872b5eb 100644
--- a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailBody.tsx
+++ b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailBody.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { Box } from "metabase/ui";
import type {
DatasetColumn,
diff --git a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailHeader.tsx b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailHeader.tsx
index 8e527caa27e..b652f814e0b 100644
--- a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailHeader.tsx
+++ b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailHeader.tsx
@@ -1,4 +1,5 @@
import cx from "classnames";
+import type { JSX } from "react";
import { t } from "ttag";
import type { ActionItem } from "metabase/actions/utils";
diff --git a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailPanel.tsx b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailPanel.tsx
index 0e620349f5c..f75d945fed8 100644
--- a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailPanel.tsx
+++ b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailPanel.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import { useCallback, useEffect, useMemo, useState } from "react";
+import { type JSX, useCallback, useEffect, useMemo, useState } from "react";
import { useMount, usePrevious } from "react-use";
import { t } from "ttag";
import _ from "underscore";
diff --git a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailsTable.tsx b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailsTable.tsx
index 6409feff911..6cb2b2dd530 100644
--- a/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailsTable.tsx
+++ b/frontend/src/metabase/visualizations/components/ObjectDetail/ObjectDetailsTable.tsx
@@ -1,5 +1,5 @@
import cx from "classnames";
-import type { MouseEvent } from "react";
+import type { JSX, MouseEvent } from "react";
import { Fragment, useMemo } from "react";
import { t } from "ttag";
diff --git a/frontend/src/metabase/visualizations/components/TableInteractive/hooks/use-reset-widths-on-columns-change.ts b/frontend/src/metabase/visualizations/components/TableInteractive/hooks/use-reset-widths-on-columns-change.ts
index 293edab7bf5..78feab7c0d1 100644
--- a/frontend/src/metabase/visualizations/components/TableInteractive/hooks/use-reset-widths-on-columns-change.ts
+++ b/frontend/src/metabase/visualizations/components/TableInteractive/hooks/use-reset-widths-on-columns-change.ts
@@ -53,8 +53,8 @@ export function useResetWidthsOnColumnsChange(
data?: DatasetData,
question?: Question,
) {
- const prevData = useRef<DatasetData>();
- const prevDataQuestion = useRef<Question>();
+ const prevData = useRef<DatasetData>(undefined);
+ const prevDataQuestion = useRef<Question>(undefined);
useEffect(() => {
const isDataChange =
diff --git a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
index ac3f8aadbbd..be9849103fe 100644
--- a/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
+++ b/frontend/src/metabase/visualizations/components/Visualization/Visualization.tsx
@@ -4,6 +4,7 @@ import React, {
type CSSProperties,
type ComponentType,
type ErrorInfo,
+ type JSX,
PureComponent,
type ReactNode,
type Ref,
diff --git a/frontend/src/metabase/visualizations/components/skeletons/AreaSkeleton/AreaSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/AreaSkeleton/AreaSkeleton.tsx
index c2976272fd3..aa9a6960492 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/AreaSkeleton/AreaSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/AreaSkeleton/AreaSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
import S from "./AreaSkeleton.module.css";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/BarSkeleton/BarSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/BarSkeleton/BarSkeleton.tsx
index c36a4707717..5c264323792 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/BarSkeleton/BarSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/BarSkeleton/BarSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const BarSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeleton.tsx
index 478fd623e02..8ece6dfa81f 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeleton.tsx
@@ -1,4 +1,4 @@
-import type { HTMLAttributes } from "react";
+import type { HTMLAttributes, JSX } from "react";
import AreaSkeleton from "metabase/visualizations/components/skeletons/AreaSkeleton";
import BarSkeleton from "metabase/visualizations/components/skeletons/BarSkeleton";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/FunnelSkeleton/FunnelSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/FunnelSkeleton/FunnelSkeleton.tsx
index 94476f166b9..29059ddcbd5 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/FunnelSkeleton/FunnelSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/FunnelSkeleton/FunnelSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const FunnelSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/GaugeSkeleton/GaugeSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/GaugeSkeleton/GaugeSkeleton.tsx
index 795a1706ee1..03b05f43f35 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/GaugeSkeleton/GaugeSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/GaugeSkeleton/GaugeSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const GaugeSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/LineSkeleton/LineSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/LineSkeleton/LineSkeleton.tsx
index 4f74b456268..2d7f32dffae 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/LineSkeleton/LineSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/LineSkeleton/LineSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
import S from "./LineSkeleton.module.css";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/MapSkeleton/MapSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/MapSkeleton/MapSkeleton.tsx
index d2cdefd4cf3..71ded881577 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/MapSkeleton/MapSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/MapSkeleton/MapSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import mapImage from "assets/img/map.svg?url";
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/PieSkeleton/PieSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/PieSkeleton/PieSkeleton.tsx
index e6e620bcf08..4ae439710e9 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/PieSkeleton/PieSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/PieSkeleton/PieSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const PieSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/ProgressSkeleton/ProgressSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/ProgressSkeleton/ProgressSkeleton.tsx
index 26a8677e46d..54368d9ef0b 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/ProgressSkeleton/ProgressSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/ProgressSkeleton/ProgressSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const ProgressSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/RowSkeleton/RowSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/RowSkeleton/RowSkeleton.tsx
index e7e26ccdc3a..fe0d7d6b300 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/RowSkeleton/RowSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/RowSkeleton/RowSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const RowSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/SankeySkeleton/SankeySkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/SankeySkeleton/SankeySkeleton.tsx
index f1e098fa307..dec52e5ae68 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/SankeySkeleton/SankeySkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/SankeySkeleton/SankeySkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const SankeySkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/components/skeletons/ScalarSkeleton/ScalarSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/ScalarSkeleton/ScalarSkeleton.tsx
index ab86bd10415..921c3cd39de 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/ScalarSkeleton/ScalarSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/ScalarSkeleton/ScalarSkeleton.tsx
@@ -1,4 +1,4 @@
-import { useLayoutEffect, useRef, useState } from "react";
+import { type JSX, useLayoutEffect, useRef, useState } from "react";
import { Box, Flex, Skeleton, Stack } from "metabase/ui";
import resizeObserver from "metabase/utils/resize-observer";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/ScatterSkeleton/ScatterSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/ScatterSkeleton/ScatterSkeleton.tsx
index e0b7c78cbba..484bb409e47 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/ScatterSkeleton/ScatterSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/ScatterSkeleton/ScatterSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
import S from "./ScatterSkeleton.module.css";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/SkeletonCaption/SkeletonCaption.tsx b/frontend/src/metabase/visualizations/components/skeletons/SkeletonCaption/SkeletonCaption.tsx
index 9d32366fbd2..67389e4f0fc 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/SkeletonCaption/SkeletonCaption.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/SkeletonCaption/SkeletonCaption.tsx
@@ -1,4 +1,4 @@
-import type { HTMLAttributes } from "react";
+import type { HTMLAttributes, JSX } from "react";
import { Markdown } from "metabase/common/components/Markdown";
import { Box, Ellipsified, Flex, Icon, Tooltip } from "metabase/ui";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/StaticSkeleton/StaticSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/StaticSkeleton/StaticSkeleton.tsx
index 0526a39f2a4..0d63c3fef6b 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/StaticSkeleton/StaticSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/StaticSkeleton/StaticSkeleton.tsx
@@ -1,4 +1,4 @@
-import type { HTMLAttributes, ReactNode } from "react";
+import type { HTMLAttributes, JSX, ReactNode } from "react";
import { EntityIcon } from "metabase/common/components/EntityIcon";
import { MarkdownPreview } from "metabase/common/components/MarkdownPreview";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/TableSkeleton/TableSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/TableSkeleton/TableSkeleton.tsx
index 898cb7021bd..029681f7991 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/TableSkeleton/TableSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/TableSkeleton/TableSkeleton.tsx
@@ -1,4 +1,4 @@
-import { useId } from "react";
+import { type JSX, useId } from "react";
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/VisualizationSkeleton/VisualizationSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/VisualizationSkeleton/VisualizationSkeleton.tsx
index 0dbb371e64d..6933260dc4f 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/VisualizationSkeleton/VisualizationSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/VisualizationSkeleton/VisualizationSkeleton.tsx
@@ -1,4 +1,4 @@
-import type { HTMLAttributes } from "react";
+import type { HTMLAttributes, JSX } from "react";
import { Flex } from "metabase/ui";
import SkeletonCaption from "metabase/visualizations/components/skeletons/SkeletonCaption";
diff --git a/frontend/src/metabase/visualizations/components/skeletons/WaterfallSkeleton/WaterfallSkeleton.tsx b/frontend/src/metabase/visualizations/components/skeletons/WaterfallSkeleton/WaterfallSkeleton.tsx
index 36a4abeb945..22f39772068 100644
--- a/frontend/src/metabase/visualizations/components/skeletons/WaterfallSkeleton/WaterfallSkeleton.tsx
+++ b/frontend/src/metabase/visualizations/components/skeletons/WaterfallSkeleton/WaterfallSkeleton.tsx
@@ -1,3 +1,5 @@
+import type { JSX } from "react";
+
import { ChartSkeletonImage } from "metabase/visualizations/components/skeletons/ChartSkeleton/ChartSkeletonImage";
const WaterfallSkeleton = (): JSX.Element => {
diff --git a/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx b/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
index 0f5ce39b2df..445dc675a86 100644
--- a/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
+++ b/frontend/src/metabase/visualizations/echarts/cartesian/option/tooltip.tsx
@@ -50,7 +50,7 @@ export const getTooltipOption = (
chartModel: BaseCartesianChartModel,
settings: ComputedVisualizationSettings,
display: CardDisplayType,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
): TooltipOption => {
return {
...getTooltipBaseOption(containerRef),
diff --git a/frontend/src/metabase/visualizations/echarts/pie/tooltip.tsx b/frontend/src/metabase/visualizations/echarts/pie/tooltip.tsx
index be2629f4bd9..f3d888a2a5b 100644
--- a/frontend/src/metabase/visualizations/echarts/pie/tooltip.tsx
+++ b/frontend/src/metabase/visualizations/echarts/pie/tooltip.tsx
@@ -28,7 +28,7 @@ const ChartItemTooltip = ({
export const getTooltipOption = (
chartModel: PieChartModel,
formatters: PieChartFormatters,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
): TooltipOption => {
return {
...getTooltipBaseOption(containerRef),
diff --git a/frontend/src/metabase/visualizations/lib/exports-branding-utils.tsx b/frontend/src/metabase/visualizations/lib/exports-branding-utils.tsx
index d3afeab491e..224e0282311 100644
--- a/frontend/src/metabase/visualizations/lib/exports-branding-utils.tsx
+++ b/frontend/src/metabase/visualizations/lib/exports-branding-utils.tsx
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import ReactDOMServer from "react-dom/server";
import { t } from "ttag";
diff --git a/frontend/src/metabase/visualizations/lib/register-jsx-formatting.unit.spec.tsx b/frontend/src/metabase/visualizations/lib/register-jsx-formatting.unit.spec.tsx
index bf02616a594..2d8b273c805 100644
--- a/frontend/src/metabase/visualizations/lib/register-jsx-formatting.unit.spec.tsx
+++ b/frontend/src/metabase/visualizations/lib/register-jsx-formatting.unit.spec.tsx
@@ -1,5 +1,4 @@
-import type { ReactElement } from "react";
-import { isElementOfType } from "react-dom/test-utils";
+import type { JSX, ReactElement } from "react";
import { setupSdkPlugins } from "__support__/enterprise";
import { mockSettings } from "__support__/settings";
@@ -17,6 +16,7 @@ import {
} from "metabase-types/api/mocks";
import { registerJsxFormatting } from "./register-jsx-formatting";
+import { isElementOfType } from "./test-utils";
// These are integration tests for the JSX renderers this module registers into
// value-formatting. The pure engine behaviour (string outputs, non-jsx paths)
@@ -35,7 +35,7 @@ describe("registered JSX email formatting", () => {
expect(isElementOfType(result as JSX.Element, ExternalLink)).toBe(true);
// Unjustified type cast. FIXME
- render(result as ReactElement);
+ render(result as ReactElement<Record<string, unknown>>);
expect(screen.getByRole("link")).toHaveAttribute(
"href",
@@ -55,7 +55,7 @@ describe("registered JSX email formatting", () => {
expect(isElementOfType(result as JSX.Element, ExternalLink)).toBe(true);
// Unjustified type cast. FIXME
- render(result as ReactElement);
+ render(result as ReactElement<Record<string, unknown>>);
expect(screen.getByRole("link")).toHaveAttribute(
"href",
@@ -110,7 +110,7 @@ describe("registered JSX email formatting", () => {
expect(isElementOfType(result as JSX.Element, ExternalLink)).toBe(true);
// Unjustified type cast. FIXME
- render(result as ReactElement);
+ render(result as ReactElement<Record<string, unknown>>);
expect(screen.getByRole("link")).toHaveAttribute(
"href",
@@ -154,7 +154,7 @@ describe("registered JSX email formatting", () => {
expect(isElementOfType(result as JSX.Element, ExternalLink)).toBe(true);
// Unjustified type cast. FIXME
- render(result as ReactElement);
+ render(result as ReactElement<Record<string, unknown>>);
expect(screen.getByRole("link")).toHaveTextContent("Custom Label");
});
@@ -199,7 +199,7 @@ describe("registered JSX url formatting", () => {
jsx: true,
rich: true,
view_as: "link",
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
render(node);
const link = screen.getByRole("link");
@@ -227,7 +227,7 @@ describe("registered JSX url formatting", () => {
jsx: true,
rich: true,
view_as: "link",
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
render(node);
const link = screen.getByRole("link");
@@ -247,7 +247,7 @@ describe("registered JSX url formatting", () => {
formatValue("http://metabase.com/", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
@@ -257,7 +257,7 @@ describe("registered JSX url formatting", () => {
formatValue("https://metabase.com/", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
@@ -267,7 +267,7 @@ describe("registered JSX url formatting", () => {
formatValue("mailto:[email protected]", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
@@ -281,7 +281,7 @@ describe("registered JSX url formatting", () => {
jsx: true,
rich: true,
column: { semantic_type: TYPE.URL },
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
@@ -294,7 +294,7 @@ describe("registered JSX url formatting", () => {
jsx: true,
rich: true,
column: { semantic_type: TYPE.URL },
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
).toEqual("invalid-blah-blah-blah");
});
@@ -304,7 +304,7 @@ describe("registered JSX url formatting", () => {
formatValue("myproto:some-custom-thing", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
).toEqual("myproto:some-custom-thing");
});
@@ -312,7 +312,9 @@ describe("registered JSX url formatting", () => {
expect(
isElementOfType(
// Unjustified type cast. FIXME
- formatValue("metabase.com", { jsx: true, rich: true }) as ReactElement,
+ formatValue("metabase.com", { jsx: true, rich: true }) as ReactElement<
+ Record<string, unknown>
+ >,
ExternalLink,
),
).toEqual(false);
@@ -324,14 +326,14 @@ describe("registered JSX url formatting", () => {
formatValue("javascript:alert('pwnd')", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
).toEqual("javascript:alert('pwnd')");
expect(
// Unjustified type cast. FIXME
formatValue("data:text/plain;charset=utf-8,hello%20world", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
).toEqual("data:text/plain;charset=utf-8,hello%20world");
});
@@ -343,7 +345,7 @@ describe("registered JSX url formatting", () => {
rich: true,
column: { semantic_type: TYPE.URL },
view_as: "link",
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toEqual(true);
});
@@ -356,7 +358,7 @@ describe("registered JSX url formatting", () => {
link_url: "http://metabase.com",
view_as: "link",
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toEqual(true);
expect(formatted.props.children).toEqual("metabase link");
@@ -372,7 +374,7 @@ describe("registered JSX url formatting", () => {
link_url: "",
view_as: "link",
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toEqual(true);
expect(formatted.props.children).toEqual("metabase link");
@@ -388,7 +390,7 @@ describe("registered JSX url formatting", () => {
link_url: "http://metabase.com",
view_as: "link",
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toEqual(true);
expect(formatted.props.children).toEqual("metabase link");
@@ -426,7 +428,7 @@ describe("registered JSX url formatting", () => {
},
},
},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toBe(true);
expect(formatted.props.children).toBe("35660212261");
@@ -462,7 +464,7 @@ describe("registered JSX url formatting", () => {
},
},
},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toBe(true);
expect(formatted.props.children).toBe("1.234.567,89");
@@ -504,7 +506,7 @@ describe("registered JSX url formatting", () => {
},
},
},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(isElementOfType(formatted, ExternalLink)).toBe(true);
expect(formatted.props.children).toBe("Buy for $1,234,567.89");
@@ -525,7 +527,7 @@ describe("registered JSX url formatting", () => {
link_url: "http://metabase.com",
view_as: "link",
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
// it is not a link set on the question level
expect(isElementOfType(formatted, ExternalLink)).toEqual(false);
@@ -776,7 +778,7 @@ describe("registered JSX value formatting", () => {
formatValue("http://metabase.com/", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
@@ -787,7 +789,9 @@ describe("registered JSX value formatting", () => {
expect(
isElementOfType(
// Unjustified type cast. FIXME
- formatValue(SITE_URL, { jsx: true, rich: true }) as ReactElement,
+ formatValue(SITE_URL, { jsx: true, rich: true }) as ReactElement<
+ Record<string, unknown>
+ >,
Link,
),
).toBe(true);
@@ -813,7 +817,7 @@ describe("registered JSX value formatting", () => {
column: column,
data: [{ value: "question/12", col: column }],
},
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
Link,
),
).toEqual(true);
@@ -831,7 +835,7 @@ describe("registered JSX value formatting", () => {
type: "link",
},
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
// it's not actually a link
expect(isElementOfType(formatted, ExternalLink)).toEqual(false);
// expect the text to be in a div (which has link formatting) rather than ExternalLink
@@ -845,7 +849,7 @@ describe("registered JSX value formatting", () => {
rich: true,
view_as: "image",
column: { semantic_type: "type/ImageURL" },
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(formatted.type).toEqual("img");
expect(formatted.props.src).toEqual("http://metabase.com/logo.png");
});
@@ -862,7 +866,7 @@ describe("registered JSX value formatting", () => {
type: "link",
},
clicked: {},
- }) as ReactElement;
+ }) as ReactElement<Record<string, unknown>>;
expect(formatted.type).toEqual("img");
expect(formatted.props.src).toEqual("http://metabase.com/logo.png");
});
@@ -874,7 +878,7 @@ describe("registered JSX value formatting", () => {
formatValue("[email protected]", {
jsx: true,
rich: true,
- }) as ReactElement,
+ }) as ReactElement<Record<string, unknown>>,
ExternalLink,
),
).toEqual(true);
diff --git a/frontend/src/metabase/visualizations/lib/test-utils.ts b/frontend/src/metabase/visualizations/lib/test-utils.ts
new file mode 100644
index 00000000000..8f77b005d71
--- /dev/null
+++ b/frontend/src/metabase/visualizations/lib/test-utils.ts
@@ -0,0 +1,7 @@
+import { type ElementType, isValidElement } from "react";
+
+// React 19 removed `react-dom/test-utils`, including `isElementOfType`.
+// This is the same check: a valid element whose `type` matches.
+export function isElementOfType(element: unknown, type: ElementType): boolean {
+ return isValidElement(element) && element.type === type;
+}
diff --git a/frontend/src/metabase/visualizations/register.ts b/frontend/src/metabase/visualizations/register.ts
index c5ba0772bf4..02cb6e8ffde 100644
--- a/frontend/src/metabase/visualizations/register.ts
+++ b/frontend/src/metabase/visualizations/register.ts
@@ -13,6 +13,7 @@ import {
type ChartSettingColorRangeProps,
type ComputedVisualizationSettings,
type SettingsExtra,
+ loadVisualizationComponents,
registerSettingWidgets,
registerVisualization,
setComputedSettingsTransform,
@@ -250,9 +251,26 @@ function registerSdkAwareBehaviors() {
);
}
+declare global {
+ interface Window {
+ METABASE_LOAD_ALL_VISUALIZATIONS?: boolean;
+ }
+}
+
export function registerVisualizations() {
registerVisualizationComponents();
registerVisualizationSettingWidgets();
registerJsxFormatting();
registerSdkAwareBehaviors();
+
+ // Charts render through a `lazy` boundary that suspends on first render. A
+ // test that freezes the clock strands that boundary on its fallback, because
+ // React 19 schedules the lazy retry on a timer the fake clock never advances.
+ // When a spec opts in, load every chart up front so no boundary suspends.
+ if (
+ typeof window !== "undefined" &&
+ window.METABASE_LOAD_ALL_VISUALIZATIONS
+ ) {
+ loadVisualizationComponents();
+ }
}
diff --git a/frontend/src/metabase/visualizations/types/click-actions.ts b/frontend/src/metabase/visualizations/types/click-actions.ts
index 610b464d00c..affda9a6d07 100644
--- a/frontend/src/metabase/visualizations/types/click-actions.ts
+++ b/frontend/src/metabase/visualizations/types/click-actions.ts
@@ -1,4 +1,5 @@
import type React from "react";
+import type { JSX } from "react";
import type { Dispatch, GetState } from "metabase/redux/store";
import type * as Lib from "metabase-lib";
diff --git a/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
index 330d420bfc0..a66ae2dfc09 100644
--- a/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/BoxPlot/BoxPlot.tsx
@@ -61,7 +61,7 @@ function BoxPlotInner({
titleMenuItems,
}: VisualizationProps) {
const containerRef = useRef<HTMLDivElement>(null);
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
const [chartInstance, setChartInstance] = useState<EChartsType>();
const [chartSize, setChartSize] = useState({ width: 0, height: 0 });
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
index 103e06f7564..0c25876488e 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/CartesianChart.tsx
@@ -118,7 +118,7 @@ function CartesianChartInner(props: VisualizationProps) {
);
useChartDebug({ isQueryBuilder, rawSeries, option, chartModel });
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
// Mirror the ECharts instance into state so that effects depending on it
// (e.g. brush setup) re-run once it becomes available. The renderer renders
// nothing until ExplicitSize has measured it, which it does a tick after
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventChip.tsx b/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventChip.tsx
index b54fcd17752..9b58cda7ecf 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventChip.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventChip.tsx
@@ -73,7 +73,7 @@ export const TimelineEventChip = ({
const [openedByKeyboard, setOpenedByKeyboard] = useState(false);
const openedRef = useRef(opened);
openedRef.current = opened;
- const hoverTimeoutRef = useRef<number>();
+ const hoverTimeoutRef = useRef<number | undefined>(undefined);
const dropdownRef = useRef<HTMLDivElement>(null);
const cancelPendingHover = () => {
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventStack.tsx b/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventStack.tsx
index 71d888da8d2..2399de9bdac 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventStack.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/TimelineEventsBand/TimelineEventStack.tsx
@@ -57,7 +57,7 @@ export const TimelineEventStack = ({
const count = groups.length;
const wrapperRef = useRef<HTMLDivElement>(null);
- const collapseTimeoutRef = useRef<number>();
+ const collapseTimeoutRef = useRef<number>(undefined);
const isPointerInsideRef = useRef(false);
const onExpandedChangeRef = useRef(onExpandedChange);
onExpandedChangeRef.current = onExpandedChange;
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.ts
index 529fbc00eb2..47bc7c409d8 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.ts
@@ -62,7 +62,7 @@ const addPointerListeners = (
*/
export const useBrush = (
chartRef: MutableRefObject<EChartsType | undefined>,
- containerRef: RefObject<HTMLDivElement>,
+ containerRef: RefObject<HTMLDivElement | null>,
canBrushChart: boolean,
isBrushable: boolean,
// ECharts option object — used as a signal dep to re-enable brush after
@@ -153,13 +153,13 @@ function useTouchBrush({
disableBrush,
}: {
chartRef: MutableRefObject<EChartsType | undefined>;
- containerRef: RefObject<HTMLDivElement>;
+ containerRef: RefObject<HTMLDivElement | null>;
isTouch: boolean;
canBrushChart: boolean;
enableBrush: () => void;
disableBrush: () => void;
}) {
- const timerRef = useRef<ReturnType<typeof setTimeout>>();
+ const timerRef = useRef<ReturnType<typeof setTimeout>>(undefined);
const startRef = useRef<Point | null>(null);
const activeRef = useRef(false);
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.unit.spec.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.unit.spec.ts
index add6ad43150..f44f8a409e2 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.unit.spec.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-brush.unit.spec.ts
@@ -51,7 +51,7 @@ const createMockContainerRef = () => {
);
// Unjustified type cast. FIXME
- const containerRef = { current: element } as RefObject<HTMLDivElement>;
+ const containerRef = { current: element } as RefObject<HTMLDivElement | null>;
return { containerRef, el: element };
};
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts
index e4abb7b8d23..f7319cb2c75 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-chart-events.ts
@@ -74,7 +74,7 @@ function clearBrush(
export const useChartEvents = (
chartRef: React.MutableRefObject<EChartsType | undefined>,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
chartModel: BaseCartesianChartModel,
option: EChartsOption,
renderingContext: RenderingContext,
@@ -102,7 +102,7 @@ export const useChartEvents = (
) => {
// Read at call time so the handler list does not rebuild on metadata change.
const store = useStore();
- const isBrushing = useRef<boolean>();
+ const isBrushing = useRef<boolean>(undefined);
useTooltipMouseLeave(chartRef, onHoverChange, containerRef);
const getQuestionCard = useCallback(
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
index 79373e59554..742840be24f 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-models-and-option.ts
@@ -39,7 +39,7 @@ export function useModelsAndOption(
onRender,
isDashboard,
}: VisualizationProps,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
containerSize: Pick<VisualizationProps, "width" | "height">,
) {
const tc = useTranslateContent();
diff --git a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-tooltip-mouse-leave.ts b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-tooltip-mouse-leave.ts
index 4a3ac57233c..fc2d146a8dc 100644
--- a/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-tooltip-mouse-leave.ts
+++ b/frontend/src/metabase/visualizations/visualizations/CartesianChart/use-tooltip-mouse-leave.ts
@@ -11,7 +11,7 @@ const MOUSEMOVE_THROTTLE_MS = 50;
export const useTooltipMouseLeave = (
chartRef?: React.MutableRefObject<EChartsType | undefined>,
onHoverChange?: VisualizationProps["onHoverChange"],
- containerRef?: React.RefObject<HTMLDivElement>,
+ containerRef?: React.RefObject<HTMLDivElement | null>,
) => {
const isMouseOverTooltipRef = useRef(false);
diff --git a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.stories.tsx b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.stories.tsx
index c37f8f80e03..5402441c5a8 100644
--- a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.stories.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.stories.tsx
@@ -4,6 +4,7 @@ import { createMockSettingsState, createMockState } from "__support__/state";
import {
SdkVisualizationWrapper,
VisualizationWrapper,
+ createWaitForChartsDecorator,
} from "__support__/storybook";
import type { MetabaseTheme } from "metabase/embedding-sdk/theme";
import { Box } from "metabase/ui";
@@ -18,6 +19,7 @@ import { data } from "./stories-data";
export default {
title: "viz/PieChart",
component: PieChart,
+ decorators: [createWaitForChartsDecorator({ count: 1 })],
};
registerVisualization(PieChart);
diff --git a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
index 1f6274f251c..2b3e62c5dfe 100644
--- a/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/PieChart/PieChart.tsx
@@ -30,7 +30,7 @@ function PieChartComponent(props: VisualizationProps) {
const hoveredSliceKeyPath = props.hovered?.pieSliceKeyPath;
const containerRef = useRef<HTMLDivElement>(null);
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
const [sideLength, setSideLength] = useState(0);
const [hiddenSlices, toggleSliceVisibility] = useLegendHiddenSeries<
diff --git a/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.stories.tsx b/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.stories.tsx
index eb47560ba01..45091a7743e 100644
--- a/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.stories.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.stories.tsx
@@ -3,6 +3,7 @@ import type { StoryFn } from "@storybook/react";
import {
IsomorphicVisualizationStory,
SdkVisualizationStory,
+ createWaitForChartsDecorator,
} from "__support__/storybook";
import type { MetabaseTheme } from "metabase/embedding-sdk/theme";
import { registerVisualizations } from "metabase/visualizations/register";
@@ -15,6 +16,7 @@ registerVisualizations();
export default {
title: "viz/SankeyChart",
component: IsomorphicVisualizationStory,
+ decorators: [createWaitForChartsDecorator({ count: 1 })],
};
type SankeyStoryProps = {
diff --git a/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.tsx b/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.tsx
index 2ed89d084ca..18a528c5926 100644
--- a/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/SankeyChart/SankeyChart.tsx
@@ -35,7 +35,7 @@ const SankeyChartComponent = ({
);
const containerRef = useRef<HTMLDivElement>(null);
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
const renderingContext = useBrowserRenderingContext({ fontFamily });
const chartModel = useMemo(
() => getSankeyChartModel(rawSeriesWithRemappings, settings),
diff --git a/frontend/src/metabase/visualizations/visualizations/SmartScalar/compute.ts b/frontend/src/metabase/visualizations/visualizations/SmartScalar/compute.ts
index 861da4abb6a..d18c695516b 100644
--- a/frontend/src/metabase/visualizations/visualizations/SmartScalar/compute.ts
+++ b/frontend/src/metabase/visualizations/visualizations/SmartScalar/compute.ts
@@ -1,3 +1,4 @@
+import type { JSX } from "react";
import { t } from "ttag";
import { dayjs } from "metabase/dayjs";
diff --git a/frontend/src/metabase/visualizations/visualizations/Table/Table.stories.tsx b/frontend/src/metabase/visualizations/visualizations/Table/Table.stories.tsx
index a6c33e22542..e1d64fb0be4 100644
--- a/frontend/src/metabase/visualizations/visualizations/Table/Table.stories.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/Table/Table.stories.tsx
@@ -1,5 +1,8 @@
+// @ts-expect-error There is no type definition
+import createAsyncCallback from "@loki/create-async-callback";
import type { Store } from "@reduxjs/toolkit";
import type { StoryFn } from "@storybook/react";
+import { expect, waitFor } from "@storybook/test";
import { getCommonStore } from "__support__/entities-store";
import { mockSettings } from "__support__/settings";
@@ -38,10 +41,7 @@ export default {
decorators: [createWaitForResizeToStopDecorator()],
};
-const DefaultTemplate: StoryFn<{
- series: RawSeries;
- isDashboard?: boolean;
-}> = ({
+const DefaultTemplate = ({
series,
isDashboard,
bgColor = "core-white",
@@ -182,6 +182,27 @@ export const TableWithImages = {
args: {
series: data.images,
},
+
+ // The cells load external images, which React 19 mounts after the fixed
+ // resize-settle delay, so loki would capture the table before they paint.
+ // Hold the snapshot until every image has finished loading.
+ play: async ({ canvasElement }: { canvasElement: HTMLElement }) => {
+ const asyncCallback = createAsyncCallback();
+ try {
+ await waitFor(
+ () => {
+ const images = [
+ ...canvasElement.querySelectorAll<HTMLImageElement>("img"),
+ ];
+ expect(images.length).toBeGreaterThan(0);
+ expect(images.every((image) => image.complete)).toBe(true);
+ },
+ { timeout: 10000 },
+ );
+ } finally {
+ asyncCallback();
+ }
+ },
};
export const TableWithWrappedLinks = {
diff --git a/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.stories.tsx b/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.stories.tsx
index 925290ac1e4..1fa7b69a97e 100644
--- a/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.stories.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.stories.tsx
@@ -1,6 +1,9 @@
import type { StoryFn } from "@storybook/react";
-import { VisualizationWrapper } from "__support__/storybook";
+import {
+ VisualizationWrapper,
+ createWaitForChartsDecorator,
+} from "__support__/storybook";
import { Box } from "metabase/ui";
import Visualization from "metabase/visualizations/components/Visualization";
import { registerVisualization } from "metabase/viz-core";
@@ -12,6 +15,7 @@ import { data } from "./stories-data";
export default {
title: "viz/TreemapChart",
component: TreemapChart,
+ decorators: [createWaitForChartsDecorator({ count: 1 })],
};
registerVisualization(TreemapChart);
diff --git a/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.tsx b/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.tsx
index ec5ebe5bb22..1b18c183320 100644
--- a/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/TreemapChart/TreemapChart.tsx
@@ -56,7 +56,7 @@ const TreemapChartComponent = ({
);
const containerRef = useRef<HTMLDivElement>(null);
- const chartRef = useRef<EChartsType>();
+ const chartRef = useRef<EChartsType>(undefined);
const overlayRef = useRef<TreemapHoverOverlay | null>(null);
const isAnimatingRef = useRef(false);
const clickedRef = useLatest(clicked);
diff --git a/frontend/src/metabase/visualizations/visualizations/TreemapChart/tooltip.tsx b/frontend/src/metabase/visualizations/visualizations/TreemapChart/tooltip.tsx
index 7abd36b48ac..96933827305 100644
--- a/frontend/src/metabase/visualizations/visualizations/TreemapChart/tooltip.tsx
+++ b/frontend/src/metabase/visualizations/visualizations/TreemapChart/tooltip.tsx
@@ -27,7 +27,7 @@ export function getTreemapTooltipOption(
colors: Record<string, string>,
formatValue: (value: number) => string,
formatPercent: (ratio: number) => string,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
getViewRootId: () => string | null,
getIsClicked: () => boolean,
getIsAnimating: () => boolean,
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
index 729d5425306..77143b92213 100644
--- a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.ts
@@ -173,6 +173,13 @@ export const getBoxPlotOption = (
settings,
);
+ // echarts crashes building a cartesian coordinate system that has an x-axis
+ // but no y-axis, which happens when no y-axis model resolves on an empty
+ // render. Render an empty chart instead of emitting a lone x-axis.
+ if (yAxis.length === 0) {
+ return {};
+ }
+
const boxDimensions = [
X_AXIS_DATA_KEY,
...chartModel.seriesModels.flatMap((seriesModel) =>
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts
index d12aac8e2ca..b588f53cdaf 100644
--- a/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/option/index.unit.spec.ts
@@ -1,5 +1,5 @@
import { DEFAULT_METABASE_COMPONENT_THEME } from "metabase/ui";
-import type { RawSeries } from "metabase-types/api";
+import type { RawSeries, RowValues } from "metabase-types/api";
import {
createMockCard,
createMockColumn,
@@ -30,30 +30,36 @@ const otherMetric = createMockColumn({
display_name: "Other",
base_type: "type/Integer",
});
-const rawSeries: RawSeries = [
- {
- card: createMockCard({ id: 1, display: "boxplot" }),
- data: createMockDatasetData({
- cols: [category, metric, otherMetric],
- rows: [1000, 2000, 2500, 3000, 4000, 15000].map((value) => [
- "A",
- value,
- value * 10,
- ]),
- }),
- },
-];
+const filledRows = [1000, 2000, 2500, 3000, 4000, 15000].map((value) => [
+ "A",
+ value,
+ value * 10,
+]);
+
+function makeRawSeries(rows: RowValues[]): RawSeries {
+ return [
+ {
+ card: createMockCard({ id: 1, display: "boxplot" }),
+ data: createMockDatasetData({
+ cols: [category, metric, otherMetric],
+ rows,
+ }),
+ },
+ ];
+}
function setup({
cartesianSize = "small",
settings: overrides = {},
staticViz = false,
height = 450,
+ rows = filledRows,
}: {
cartesianSize?: CartesianChartSize;
settings?: ComputedVisualizationSettings;
staticViz?: boolean;
height?: number;
+ rows?: RowValues[];
} = {}) {
const settings = createMockVisualizationSettings({
"graph.dimensions": ["category"],
@@ -83,7 +89,7 @@ function setup({
}),
};
const model = getBoxPlotModel(
- rawSeries,
+ makeRawSeries(rows),
settings,
[],
undefined,
@@ -114,6 +120,13 @@ function setup({
return { model, layout, settings, option, renderingContext };
}
+describe("empty series", () => {
+ it("returns an empty option instead of emitting a lone x-axis", () => {
+ const { option } = setup({ rows: [] });
+ expect(option).toEqual({});
+ });
+});
+
describe("responsive BoxPlot presentation", () => {
it.each(["small", "medium", "large", "fullscreen"] as const)(
"uses the %s size policy for axes and data labels",
diff --git a/frontend/src/metabase/viz-core/echarts/boxplot/option/tooltip.tsx b/frontend/src/metabase/viz-core/echarts/boxplot/option/tooltip.tsx
index 926f7160cbc..c160a249bf0 100644
--- a/frontend/src/metabase/viz-core/echarts/boxplot/option/tooltip.tsx
+++ b/frontend/src/metabase/viz-core/echarts/boxplot/option/tooltip.tsx
@@ -49,7 +49,7 @@ const BoxPlotItemTooltip = ({
export const getBoxPlotTooltipOption = (
chartModel: BoxPlotChartModel,
settings: ComputedVisualizationSettings,
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
): TooltipOption => {
return {
...getTooltipBaseOption(containerRef),
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
index 0549ff6a9ec..5ef6a2efb4c 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.ts
@@ -365,6 +365,13 @@ export const getCartesianChartOption = (
}
}
+ // echarts crashes building a cartesian coordinate system that has an x-axis
+ // but no y-axis, which happens on a render with no visible series. Drop the
+ // lone x-axis so an empty chart renders instead of throwing.
+ if (yAxis.length === 0) {
+ xAxis = [];
+ }
+
return {
...getSharedEChartsOptions(isAnimated, renderingContext),
...splitPanelOverrides,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.unit.spec.ts
index 08e70ae9455..0064e6555ed 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/option/index.unit.spec.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/option/index.unit.spec.ts
@@ -171,6 +171,55 @@ describe("ensureRoomForLabels", () => {
});
});
+describe("empty series", () => {
+ it("renders without a lone x-axis and does not crash echarts", () => {
+ seriesFn.mockReturnValue({ display: "bar" });
+ const renderingContext: RenderingContext = {
+ ...mockRenderingContext,
+ getColor: () => "#509EE3",
+ };
+ const chartModel = getCartesianChartModel(
+ [mockSeries],
+ mockSettings,
+ ["1:count"],
+ renderingContext,
+ );
+ const chartLayout = getChartLayout(
+ chartModel,
+ mockSettings,
+ hasTimelineEvents,
+ chartWidth,
+ chartHeight,
+ renderingContext,
+ );
+
+ const option = getCartesianChartOption(
+ chartModel,
+ chartLayout,
+ hasTimelineEvents,
+ null,
+ [],
+ mockSettings,
+ chartWidth,
+ false,
+ renderingContext,
+ );
+
+ expect(option.xAxis).toEqual([]);
+ expect(option.yAxis).toEqual([]);
+
+ const dom = document.createElement("div");
+ document.body.appendChild(dom);
+ const chart = echarts.init(dom, undefined, {
+ renderer: "svg",
+ width: 600,
+ height: 400,
+ });
+ expect(() => chart.setOption(option)).not.toThrow();
+ chart.dispose();
+ });
+});
+
describe("brushSelected / brushEnd ordering", () => {
it("does not throttle brushSelected in getSharedEChartsOptions", () => {
const renderingContext: RenderingContext = {
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
index a115a8c2a03..319d3c816fa 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.ts
@@ -126,6 +126,13 @@ export function getScatterPlotOption(
yAxis = axes.yAxis;
}
+ // echarts crashes building a cartesian coordinate system that has an x-axis
+ // but no y-axis, which happens on a render with no visible series. Drop the
+ // lone x-axis so an empty chart renders instead of throwing.
+ if (yAxis.length === 0) {
+ xAxis = [];
+ }
+
return {
...getSharedEChartsOptions(isAnimated, renderingContext),
...splitPanelOverrides,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.unit.spec.ts
new file mode 100644
index 00000000000..b85ac168a29
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/scatter/option/index.unit.spec.ts
@@ -0,0 +1,105 @@
+import { ScatterChart } from "echarts/charts";
+import {
+ BrushComponent,
+ GridComponent,
+ ToolboxComponent,
+} from "echarts/components";
+import * as echarts from "echarts/core";
+import { SVGRenderer } from "echarts/renderers";
+
+import type { RawSeries } from "metabase-types/api";
+import {
+ createMockCard,
+ createMockColumn,
+ createMockDatasetData,
+ createMockVisualizationSettings,
+} from "metabase-types/api/mocks";
+
+import { DEFAULT_VISUALIZATION_THEME } from "../../../../shared/utils/theme";
+import type { RenderingContext } from "../../../../types";
+import { getChartLayout } from "../../layout";
+import { getScatterPlotModel } from "../model";
+
+import { getScatterPlotOption } from "./index";
+
+echarts.use([
+ ScatterChart,
+ GridComponent,
+ BrushComponent,
+ ToolboxComponent,
+ SVGRenderer,
+]);
+
+const renderingContext: RenderingContext = {
+ getColor: () => "#509EE3",
+ measureText: (text) => text.length * 8,
+ measureTextHeight: () => 12,
+ fontFamily: "Lato",
+ theme: DEFAULT_VISUALIZATION_THEME,
+};
+
+const rawSeries: RawSeries = [
+ {
+ card: createMockCard({ id: 1, display: "scatter" }),
+ data: createMockDatasetData({
+ cols: [
+ createMockColumn({ name: "x", base_type: "type/Integer" }),
+ createMockColumn({ name: "y", base_type: "type/Integer" }),
+ ],
+ rows: [
+ [1, 10],
+ [2, 20],
+ [3, 30],
+ ],
+ }),
+ },
+];
+
+const settings = createMockVisualizationSettings({
+ "graph.dimensions": ["x"],
+ "graph.metrics": ["y"],
+});
+
+describe("getScatterPlotOption", () => {
+ it("renders without a lone x-axis and does not crash echarts when there are no series", () => {
+ const chartModel = getScatterPlotModel(
+ rawSeries,
+ settings,
+ ["1:y"],
+ renderingContext,
+ );
+ const chartLayout = getChartLayout(
+ chartModel,
+ settings,
+ false,
+ 480,
+ 360,
+ renderingContext,
+ );
+
+ const option = getScatterPlotOption(
+ chartModel,
+ chartLayout,
+ false,
+ null,
+ [],
+ settings,
+ 480,
+ false,
+ renderingContext,
+ );
+
+ expect(option.xAxis).toEqual([]);
+ expect(option.yAxis).toEqual([]);
+
+ const dom = document.createElement("div");
+ document.body.appendChild(dom);
+ const chart = echarts.init(dom, undefined, {
+ renderer: "svg",
+ width: 600,
+ height: 400,
+ });
+ expect(() => chart.setOption(option)).not.toThrow();
+ chart.dispose();
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
index 2eee52f7fe8..af4a20391df 100644
--- a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.ts
@@ -219,6 +219,13 @@ export const getWaterfallChartOption = (
isAnimated: boolean,
renderingContext: RenderingContext,
): EChartsCoreOption => {
+ // A render with no series (an empty-data transient under React 19) would
+ // crash building the single waterfall series and the cartesian axes. Render
+ // an empty chart instead.
+ if (chartModel.seriesModels.length === 0) {
+ return {};
+ }
+
const dataSeriesOptions = buildEChartsWaterfallSeries(
chartModel,
settings,
diff --git a/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.unit.spec.ts b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.unit.spec.ts
new file mode 100644
index 00000000000..885efe4ee91
--- /dev/null
+++ b/frontend/src/metabase/viz-core/echarts/cartesian/waterfall/option/index.unit.spec.ts
@@ -0,0 +1,77 @@
+import type { RawSeries } from "metabase-types/api";
+import {
+ createMockCard,
+ createMockColumn,
+ createMockDatasetData,
+ createMockVisualizationSettings,
+} from "metabase-types/api/mocks";
+
+import { DEFAULT_VISUALIZATION_THEME } from "../../../../shared/utils/theme";
+import type { RenderingContext } from "../../../../types";
+import { getChartLayout } from "../../layout";
+import { getWaterfallChartModel } from "../model";
+
+import { getWaterfallChartOption } from "./index";
+
+const renderingContext: RenderingContext = {
+ getColor: () => "#509EE3",
+ measureText: (text) => text.length * 8,
+ measureTextHeight: () => 12,
+ fontFamily: "Lato",
+ theme: DEFAULT_VISUALIZATION_THEME,
+};
+
+const rawSeries: RawSeries = [
+ {
+ card: createMockCard({ id: 1, name: "Waterfall", display: "waterfall" }),
+ data: createMockDatasetData({
+ cols: [
+ createMockColumn({ name: "bucket", base_type: "type/Text" }),
+ createMockColumn({ name: "count", base_type: "type/Integer" }),
+ ],
+ rows: [
+ ["a", 100],
+ ["b", -50],
+ ["c", 300],
+ ],
+ }),
+ },
+];
+
+const settings = createMockVisualizationSettings({
+ "graph.dimensions": ["bucket"],
+ "graph.metrics": ["count"],
+});
+
+describe("getWaterfallChartOption", () => {
+ it("returns an empty option when there are no series", () => {
+ const chartModel = getWaterfallChartModel(
+ rawSeries,
+ settings,
+ [],
+ renderingContext,
+ );
+ const chartLayout = getChartLayout(
+ chartModel,
+ settings,
+ false,
+ 480,
+ 360,
+ renderingContext,
+ );
+
+ const option = getWaterfallChartOption(
+ { ...chartModel, seriesModels: [] },
+ 480,
+ chartLayout,
+ false,
+ null,
+ [],
+ settings,
+ false,
+ renderingContext,
+ );
+
+ expect(option).toEqual({});
+ });
+});
diff --git a/frontend/src/metabase/viz-core/echarts/graph/sankey/option/tooltip.tsx b/frontend/src/metabase/viz-core/echarts/graph/sankey/option/tooltip.tsx
index fd8be7148cc..b4b70120250 100644
--- a/frontend/src/metabase/viz-core/echarts/graph/sankey/option/tooltip.tsx
+++ b/frontend/src/metabase/viz-core/echarts/graph/sankey/option/tooltip.tsx
@@ -95,7 +95,7 @@ const ChartItemTooltip = ({ chartModel, params }: ChartItemTooltipProps) => {
};
export const getTooltipOption = (
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
chartModel: SankeyChartModel,
): TooltipOption => {
return {
diff --git a/frontend/src/metabase/viz-core/echarts/tooltip/index.tsx b/frontend/src/metabase/viz-core/echarts/tooltip/index.tsx
index 12026d4c58a..faa8dd165b2 100644
--- a/frontend/src/metabase/viz-core/echarts/tooltip/index.tsx
+++ b/frontend/src/metabase/viz-core/echarts/tooltip/index.tsx
@@ -25,7 +25,7 @@ export function setTooltipRootProvider(provider: () => HTMLElement | null) {
}
export const getTooltipPositionFn =
- (containerRef: React.RefObject<HTMLDivElement>) =>
+ (containerRef: React.RefObject<HTMLDivElement | null>) =>
(
relativePoint: [number, number],
_params: unknown,
@@ -70,7 +70,7 @@ export const getTooltipPositionFn =
};
export const getTooltipBaseOption = (
- containerRef: React.RefObject<HTMLDivElement>,
+ containerRef: React.RefObject<HTMLDivElement | null>,
) => {
return {
enterable: true,
diff --git a/frontend/src/types/import-svg.d.ts b/frontend/src/types/import-svg.d.ts
index 1993d2ec2b9..0547fc88e0e 100644
--- a/frontend/src/types/import-svg.d.ts
+++ b/frontend/src/types/import-svg.d.ts
@@ -18,7 +18,7 @@ declare module "*.svg?source" {
declare module "*.svg?component" {
import type React from "react";
- const Component: React.VFC<React.SVGProps<SVGSVGElement>>;
+ const Component: React.FC<React.SVGProps<SVGSVGElement>>;
export default Component;
}
diff --git a/frontend/test/__support__/storybook.tsx b/frontend/test/__support__/storybook.tsx
index 7fc933c20f4..cedd9aa89ed 100644
--- a/frontend/test/__support__/storybook.tsx
+++ b/frontend/test/__support__/storybook.tsx
@@ -1,8 +1,7 @@
// Storybook helpers
// @ts-expect-error There is no type definition
import createAsyncCallback from "@loki/create-async-callback";
-import type { StoryFn } from "@storybook/react";
-import { useEffect, useMemo } from "react";
+import { type ComponentType, useEffect, useMemo } from "react";
import { createMockState } from "__support__/state";
import { SdkThemeProvider } from "embedding-sdk-bundle/components/private/SdkThemeProvider";
@@ -136,7 +135,7 @@ export const SdkVisualizationStory = ({
};
export function createWaitForResizeToStopDecorator(timeoutMs: number = 1000) {
- return function WaitForResizeToStopDecorator(Story: StoryFn) {
+ return function WaitForResizeToStopDecorator(Story: ComponentType) {
const asyncCallback = useMemo(() => createAsyncCallback(), []);
useEffect(() => {
@@ -172,15 +171,15 @@ export function createWaitForResizeToStopDecorator(timeoutMs: number = 1000) {
* of hanging.
*/
export function createWaitForChartsDecorator({
- count,
+ count = 1,
settleMs = 1000,
timeoutMs = 20000,
}: {
- count: number;
+ count?: number;
settleMs?: number;
timeoutMs?: number;
-}) {
- return function WaitForChartsDecorator(Story: StoryFn) {
+} = {}) {
+ return function WaitForChartsDecorator(Story: ComponentType) {
const asyncCallback = useMemo(() => createAsyncCallback(), []);
useEffect(() => {
@@ -198,12 +197,21 @@ export function createWaitForChartsDecorator({
};
const poll = () => {
- const renderedCount = document.querySelectorAll(
- '[data-testid="visualization-root"]',
+ // Wait for the painted ECharts root (`chart-container`) AND for every
+ // dashboard card to finish loading (`loading-indicator` gone). React 19
+ // defers the lazy ECharts chunk past a fixed settle, so both the outer
+ // `visualization-root` and the dashcard skeleton can sit there long
+ // after mount while the chart is still blank. Gating on the real chart
+ // node keeps Loki from snapshotting an empty skeleton.
+ const paintedCount = document.querySelectorAll(
+ '[data-testid="chart-container"]',
+ ).length;
+ const stillLoading = document.querySelectorAll(
+ '[data-testid="loading-indicator"]',
).length;
const timedOut = Date.now() - startedAt > timeoutMs;
- if (renderedCount >= count || timedOut) {
+ if ((paintedCount >= count && stillLoading === 0) || timedOut) {
settleTimer = setTimeout(resolve, settleMs);
return;
}
@@ -236,7 +244,7 @@ export function createWaitForChartsDecorator({
* that hide `[data-hide-on-print]` are keyed on the print media query,
* not this flag, so the snapshot is unaffected.
*/
-export function ForceDocumentCardRenderDecorator(Story: StoryFn) {
+export function ForceDocumentCardRenderDecorator(Story: ComponentType) {
return (
<PrintContext.Provider
value={{ isPrinting: true, prepareForPrint: async () => {} }}
diff --git a/frontend/test/__support__/ui.tsx b/frontend/test/__support__/ui.tsx
index bdeb19a4ad8..4703e722fa9 100644
--- a/frontend/test/__support__/ui.tsx
+++ b/frontend/test/__support__/ui.tsx
@@ -17,6 +17,7 @@ import {
import {
Children,
Fragment,
+ type JSX,
isValidElement,
useCallback,
useMemo,
@@ -438,7 +439,7 @@ function createTestRouter(holder: MemoryTestRouterHolder): TestRouter {
function childrenAreRouteTree(children: React.ReactNode): boolean {
return Children.toArray(children).some((child) => {
- if (!isValidElement(child)) {
+ if (!isValidElement<{ children?: React.ReactNode }>(child)) {
return false;
}
if (child.type === Route) {
diff --git a/frontend/test/jest-setup-env.js b/frontend/test/jest-setup-env.js
index 7f44a2ad23c..43afefb14a1 100644
--- a/frontend/test/jest-setup-env.js
+++ b/frontend/test/jest-setup-env.js
@@ -4,6 +4,8 @@ import "@testing-library/jest-dom";
import * as testingLibrary from "@testing-library/react";
import fetchMockModule from "fetch-mock";
+import { resetRouterForTests } from "metabase/router/navigator";
+
// Imports compile to lazy requires (see jest.base.conf.js). Resolve these at
// the top level, so a spec that calls jest.resetModules() cannot make the
// hooks below load a fresh copy once the run has started.
@@ -95,6 +97,10 @@ afterEach(async () => {
// Cleanup React components FIRST to trigger any unmount effects
cleanup();
+ // Clear the router shim's module-level holders so one test's navigation
+ // state cannot leak into the next.
+ resetRouterForTests();
+
delete window.MetabaseBootstrap;
// Wait for any pending fetch requests to complete
await fetchMock.callHistory.flush();
diff --git a/package.json b/package.json
index a2bcf2e50e8..311dc7df2cd 100644
--- a/package.json
+++ b/package.json
@@ -34,10 +34,10 @@
"@dnd-kit/modifiers": "^6.0.1",
"@dnd-kit/sortable": "^8.0.0",
"@dnd-kit/utilities": "^3.2.2",
- "@emotion/cache": "^11.11.0",
+ "@emotion/cache": "^11.14.0",
"@emotion/is-prop-valid": "^1.1.1",
- "@emotion/react": "^11.11.0",
- "@emotion/styled": "^11.11.0",
+ "@emotion/react": "^11.14.0",
+ "@emotion/styled": "^11.14.0",
"@floating-ui/dom": "^1.7.4",
"@floating-ui/react": "^0.27.16",
"@juggle/resize-observer": "^3.4.0",
@@ -129,12 +129,12 @@
"prosemirror-state": "^1.4.4",
"prosemirror-view": "^1.42.3",
"querystring-es3": "^0.2.1",
- "react": "^18.2.0",
+ "react": "^19.0.0",
"react-ansi-style": "^1.0.0",
"react-color": "^2.14.1",
"react-dnd": "4",
"react-dnd-html5-backend": "4",
- "react-dom": "^18.2.0",
+ "react-dom": "^19.0.0",
"react-dropzone": "^14.2.3",
"react-grid-layout": "^1.5.3",
"react-is": "^18.2.0",
@@ -177,7 +177,7 @@
"@cypress/code-coverage": "^4.0.3",
"@cypress/grep": "^6",
"@cypress/react": "^9",
- "@emotion/babel-plugin": "^11.11.0",
+ "@emotion/babel-plugin": "^11.13.5",
"@esbuild-plugins/node-modules-polyfill": "^0.2.2",
"@eslint/compat": "2.0.2",
"@eslint/js": "9.39.2",
@@ -237,9 +237,9 @@
"@types/mustache": "^4.1.2",
"@types/postcss-import": "^14.0.3",
"@types/postcss-url": "^10.0.4",
- "@types/react": "^18.3.3",
+ "@types/react": "^19.0.0",
"@types/react-color": "^2.17.6",
- "@types/react-dom": "^18.2.17",
+ "@types/react-dom": "^19.0.0",
"@types/react-grid-layout": "^1.3.5",
"@types/react-is": "^18.2.4",
"@types/react-resizable": "^3.0.4",
@@ -390,6 +390,10 @@
"@lezer/common": "^1.5.0",
"@lezer/highlight": "^1.2.1",
"@lezer/lr": "^1.4.2",
+ "@types/react": "^19.0.0",
+ "@types/react-dom": "^19.0.0",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
"ansi-regex": "5.0.1",
"cross-spawn": "^7.0.5",
"csstype": "^3.2.3",
@@ -530,5 +534,8 @@
"safari >= 18.2",
"ios_saf >= 18.2"
],
- "packageManager": "[email protected]"
+ "packageManager": "[email protected]",
+ "patchedDependencies": {
+ "@loki/[email protected]": "patches/@loki%[email protected]"
+ }
}
diff --git a/patches/@loki%[email protected] b/patches/@loki%[email protected]
new file mode 100644
index 00000000000..8234c0c6887
--- /dev/null
+++ b/patches/@loki%[email protected]
@@ -0,0 +1,18 @@
+diff --git a/src/commands/test/renderers/index.js b/src/commands/test/renderers/index.js
+index faa8206758530fc4b2685d2db147f9d02e26f6df..36562fb083b6a35dd996adaab6a18208d9c34798 100644
+--- a/src/commands/test/renderers/index.js
++++ b/src/commands/test/renderers/index.js
+@@ -3,7 +3,12 @@ const { renderVerbose } = require('./verbose');
+ const { renderNonInteractive } = require('./non-interactive');
+ const { renderSilent } = require('./silent');
+
+-const { renderInteractive } = importJsx('./interactive');
++// Load the interactive (ink) renderer lazily. It pulls react-reconciler, which
++// reads React internals that React 19 removed, so requiring it eagerly crashes
++// at load time. CI uses a non-interactive renderer and never calls this, so
++// deferring the require keeps loki working on React 19.
++const renderInteractive = (...args) =>
++ importJsx('./interactive').renderInteractive(...args);
+
+ module.exports = {
+ renderInteractive,
diff --git a/test/metabase/channel/render/body_test.clj b/test/metabase/channel/render/body_test.clj
index 01e0d69644a..ed3207902be 100644
--- a/test/metabase/channel/render/body_test.clj
+++ b/test/metabase/channel/render/body_test.clj
@@ -1309,6 +1309,24 @@
(testing "Renders with at least one category name visible"
(is (= "Doohickey" category-text)))))))))
+(deftest render-region-map-static-viz-test
+ (testing "The static-viz region (choropleth) map renders as an image, not an error card.
+ React 19's scheduler references MessageChannel, which the GraalJS render context must polyfill."
+ (mt/with-temp [:model/Card card
+ {:name "region-map-test"
+ :display :map
+ :visualization_settings {:map.type "region"
+ :map.region "us_states"
+ :map.dimension "STATE"
+ :map.metric "METRIC"}
+ :dataset_query (mt/native-query
+ {:query (str "SELECT 'CA' AS state, 99999 AS metric "
+ "UNION ALL SELECT 'NY' AS state, 11111 AS metric")})}]
+ (let [data (:data (qp/process-query (:dataset_query card)))
+ part (body/render :region_map :attachment "UTC" card nil data)]
+ (is (= :img (-> part :content second first))
+ "Region map renders as an image, not a degraded table or an error card")))))
+
(deftest render-correct-day-of-week-test
(testing "The static-viz bar chart renders with the correct start of the week."
(mt/with-temporary-setting-values [start-of-week "monday"]