The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
increase EMBEDDING_SDK_MINIMUM_REACT_MAJOR_VERSION to 19 (#85337)
Nicolò Pretto1382c5f9631f
diff --git a/e2e/test-component/scenarios/embedding-sdk/unsupported-react-version.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/unsupported-react-version.cy.spec.tsxindex f64258a0c6f..bad1cb297c8 100644--- a/e2e/test-component/scenarios/embedding-sdk/unsupported-react-version.cy.spec.tsx+++ b/e2e/test-component/scenarios/embedding-sdk/unsupported-react-version.cy.spec.tsx@@ -18,10 +18,8 @@ import { mockAuthProviderAndJwtSignIn } from "e2e/support/helpers/embedding-sdk-import { deleteConflictingCljsGlobals } from "metabase/embedding-sdk/test/delete-conflicting-cljs-globals";// MINIMUM_SUPPORTED_REACT_MAJOR_VERSION in host-react-version.ts, which is what-// the check compares against. When that moves to 19, change this to 19:-// the spec then fakes a React 18 host and expects the React 19 message. Until-// someone does, every assertion here is wrong and the spec fails.-const MINIMUM_SUPPORTED_REACT_MAJOR = 18;+// the check compares against. Change both together.+const MINIMUM_SUPPORTED_REACT_MAJOR = 19;const UNSUPPORTED_HOST_REACT_MAJOR = MINIMUM_SUPPORTED_REACT_MAJOR - 1;diff --git a/frontend/src/embedding-sdk-bundle/components/private/UnsupportedReactVersionError/UnsupportedReactVersionError.unit.spec.tsx b/frontend/src/embedding-sdk-bundle/components/private/UnsupportedReactVersionError/UnsupportedReactVersionError.unit.spec.tsxindex 900266195ed..8a0c73dbab5 100644--- a/frontend/src/embedding-sdk-bundle/components/private/UnsupportedReactVersionError/UnsupportedReactVersionError.unit.spec.tsx+++ b/frontend/src/embedding-sdk-bundle/components/private/UnsupportedReactVersionError/UnsupportedReactVersionError.unit.spec.tsx@@ -2,15 +2,15 @@ import { render, screen } from "__support__/ui";import { UnsupportedReactVersionError } from "./UnsupportedReactVersionError";-// React 17 because MINIMUM_SUPPORTED_REACT_MAJOR_VERSION in host-react-version.ts-// is 18. When that moves to 19, fake 18 here and update the message.+// React 18 because MINIMUM_SUPPORTED_REACT_MAJOR_VERSION in host-react-version.ts+// is 19. When that moves to 20, fake 19 here and update the message.jest.mock("react", () => ({...jest.requireActual("react"),- version: "17.0.2",+ version: "18.3.1",}));const UNSUPPORTED_REACT_MESSAGE =- "The Metabase modular embedding SDK requires React 18 or newer, but this application is running React 17. Upgrade your application to React 18 to display embedded content.";+ "The Metabase modular embedding SDK requires React 19 or newer, but this application is running React 18. Upgrade your application to React 19 to display embedded content.";describe("UnsupportedReactVersionError", () => {it("shows the unsupported React message and logs it to the console", () => {diff --git a/frontend/src/embedding-sdk-bundle/lib/host-react-version.ts b/frontend/src/embedding-sdk-bundle/lib/host-react-version.tsindex ff2b2f4f5ef..b786c129793 100644--- a/frontend/src/embedding-sdk-bundle/lib/host-react-version.ts+++ b/frontend/src/embedding-sdk-bundle/lib/host-react-version.ts@@ -1,7 +1,7 @@import { version as reactVersion, useEffect } from "react";// Raise this when the SDK bundle starts to need a newer React major.-const MINIMUM_SUPPORTED_REACT_MAJOR_VERSION = 18;+const MINIMUM_SUPPORTED_REACT_MAJOR_VERSION = 19;export function getHostReactMajorVersion(): number | null {const majorVersion = parseInt(reactVersion, 10);diff --git a/frontend/src/embedding-sdk-bundle/lib/host-react-version.unit.spec.ts b/frontend/src/embedding-sdk-bundle/lib/host-react-version.unit.spec.tsindex 148122acc35..0558772e9b2 100644--- a/frontend/src/embedding-sdk-bundle/lib/host-react-version.unit.spec.ts+++ b/frontend/src/embedding-sdk-bundle/lib/host-react-version.unit.spec.ts@@ -5,8 +5,8 @@ import {logUnsupportedReactVersionOnce,} from "./host-react-version";-// MINIMUM_SUPPORTED_REACT_MAJOR_VERSION is 18, so React 17 stands in for an-// unsupported host throughout. When it moves to 19, move these versions up by one.+// MINIMUM_SUPPORTED_REACT_MAJOR_VERSION is 19, so React 18 stands in for an+// unsupported host throughout. When it moves to 20, move these versions up by one.let mockReactVersion: string | undefined;jest.mock("react", () => ({@@ -35,16 +35,10 @@ describe("getHostReactMajorVersion", () => {});describe("isHostReactVersionSupported", () => {- it("does not support React 17", () => {- mockReactVersion = "17.0.2";-- expect(isHostReactVersionSupported()).toBe(false);- });-- it("supports React 18", () => {+ it("does not support React 18", () => {mockReactVersion = "18.3.1";- expect(isHostReactVersionSupported()).toBe(true);+ expect(isHostReactVersionSupported()).toBe(false);});it("supports React 19", () => {@@ -62,17 +56,17 @@ describe("isHostReactVersionSupported", () => {describe("getUnsupportedReactVersionMessage", () => {it("names the required and the detected React major versions", () => {- mockReactVersion = "17.0.2";+ mockReactVersion = "18.3.1";expect(getUnsupportedReactVersionMessage()).toBe(- "The Metabase modular embedding SDK requires React 18 or newer, but this application is running React 17. Upgrade your application to React 18 to display embedded content.",+ "The Metabase modular embedding SDK requires React 19 or newer, but this application is running React 18. Upgrade your application to React 19 to display embedded content.",);});});describe("logUnsupportedReactVersionOnce", () => {it("logs the unsupported React message once across calls", () => {- mockReactVersion = "17.0.2";+ mockReactVersion = "18.3.1";const consoleError = jest.spyOn(console, "error").mockImplementation(() => {});@@ -82,7 +76,7 @@ describe("logUnsupportedReactVersionOnce", () => {expect(consoleError).toHaveBeenCalledTimes(1);expect(consoleError).toHaveBeenCalledWith(- "The Metabase modular embedding SDK requires React 18 or newer, but this application is running React 17. Upgrade your application to React 18 to display embedded content.",+ "The Metabase modular embedding SDK requires React 19 or newer, but this application is running React 18. Upgrade your application to React 19 to display embedded content.",);consoleError.mockRestore();