From f2f7736f6876a5c43df5466a1311a7e3d3705148 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 00:10:17 +0000 Subject: [PATCH 1/5] Initial plan From 6c58bd1870a7c8c51e2ea9ea76461e43b0bb4d30 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 00:16:20 +0000 Subject: [PATCH 2/5] Fix flaky test by pinning esm.sh version and importing react-is Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com> --- tests/test_reactjs/js_fixtures/subcomponent-notation.js | 7 ++++--- tests/test_web/js_fixtures/subcomponent-notation.js | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/test_reactjs/js_fixtures/subcomponent-notation.js b/tests/test_reactjs/js_fixtures/subcomponent-notation.js index 73527c667..65d9c2ab9 100644 --- a/tests/test_reactjs/js_fixtures/subcomponent-notation.js +++ b/tests/test_reactjs/js_fixtures/subcomponent-notation.js @@ -1,6 +1,7 @@ -import React from "https://esm.sh/react@19.0" -import ReactDOM from "https://esm.sh/react-dom@19.0/client" -import {InputGroup, Form} from "https://esm.sh/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; +import React from "https://esm.sh/v135/react@19.0" +import ReactDOM from "https://esm.sh/v135/react-dom@19.0/client" +import * as ReactIs from "https://esm.sh/v135/react-is@19.0" +import {InputGroup, Form} from "https://esm.sh/v135/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; export {InputGroup, Form}; export function bind(node, config) { diff --git a/tests/test_web/js_fixtures/subcomponent-notation.js b/tests/test_web/js_fixtures/subcomponent-notation.js index 73527c667..65d9c2ab9 100644 --- a/tests/test_web/js_fixtures/subcomponent-notation.js +++ b/tests/test_web/js_fixtures/subcomponent-notation.js @@ -1,6 +1,7 @@ -import React from "https://esm.sh/react@19.0" -import ReactDOM from "https://esm.sh/react-dom@19.0/client" -import {InputGroup, Form} from "https://esm.sh/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; +import React from "https://esm.sh/v135/react@19.0" +import ReactDOM from "https://esm.sh/v135/react-dom@19.0/client" +import * as ReactIs from "https://esm.sh/v135/react-is@19.0" +import {InputGroup, Form} from "https://esm.sh/v135/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; export {InputGroup, Form}; export function bind(node, config) { From 4fa2c3b30908c2715d99669a836f0d76156fc42d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 00:17:17 +0000 Subject: [PATCH 3/5] Add changelog entry for flaky test fix Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com> --- docs/source/about/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/about/changelog.rst b/docs/source/about/changelog.rst index 6ea0fd6b0..21b4b5eb7 100644 --- a/docs/source/about/changelog.rst +++ b/docs/source/about/changelog.rst @@ -100,6 +100,7 @@ Unreleased **Fixed** +- Fixed a flaky test issue in ``test_subcomponent_notation`` where react-bootstrap components would fail to initialize due to a race condition in ESM module loading from esm.sh. The fix pins esm.sh to v135 and explicitly imports react-is to ensure proper dependency resolution order. - :pull:`1239` - Fixed a bug where script elements would not render to the DOM as plain text. - :pull:`1271` - Fixed a bug where the ``key`` property provided within server-side ReactPy code was failing to propagate to the front-end JavaScript components. - :pull:`1254` - Fixed a bug where ``RuntimeError("Hook stack is in an invalid state")`` errors could be generated when using a webserver that reuses threads. From 4d6111dd305f228a52eac825b4678ffeeb91680f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 12 Dec 2025 00:18:36 +0000 Subject: [PATCH 4/5] Add explanatory comments for ReactIs import Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com> --- tests/test_reactjs/js_fixtures/subcomponent-notation.js | 2 ++ tests/test_web/js_fixtures/subcomponent-notation.js | 2 ++ 2 files changed, 4 insertions(+) diff --git a/tests/test_reactjs/js_fixtures/subcomponent-notation.js b/tests/test_reactjs/js_fixtures/subcomponent-notation.js index 65d9c2ab9..12542786e 100644 --- a/tests/test_reactjs/js_fixtures/subcomponent-notation.js +++ b/tests/test_reactjs/js_fixtures/subcomponent-notation.js @@ -1,5 +1,7 @@ import React from "https://esm.sh/v135/react@19.0" import ReactDOM from "https://esm.sh/v135/react-dom@19.0/client" +// Explicitly import react-is to ensure it's loaded before react-bootstrap +// This prevents race conditions where react-bootstrap tries to use React context before deps are ready import * as ReactIs from "https://esm.sh/v135/react-is@19.0" import {InputGroup, Form} from "https://esm.sh/v135/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; export {InputGroup, Form}; diff --git a/tests/test_web/js_fixtures/subcomponent-notation.js b/tests/test_web/js_fixtures/subcomponent-notation.js index 65d9c2ab9..12542786e 100644 --- a/tests/test_web/js_fixtures/subcomponent-notation.js +++ b/tests/test_web/js_fixtures/subcomponent-notation.js @@ -1,5 +1,7 @@ import React from "https://esm.sh/v135/react@19.0" import ReactDOM from "https://esm.sh/v135/react-dom@19.0/client" +// Explicitly import react-is to ensure it's loaded before react-bootstrap +// This prevents race conditions where react-bootstrap tries to use React context before deps are ready import * as ReactIs from "https://esm.sh/v135/react-is@19.0" import {InputGroup, Form} from "https://esm.sh/v135/react-bootstrap@2.10.2?deps=react@19.0,react-dom@19.0,react-is@19.0&exports=InputGroup,Form"; export {InputGroup, Form}; From 6340bb50d7097542526e1c7c99667cf7ac51a61d Mon Sep 17 00:00:00 2001 From: Archmonger <16909269+Archmonger@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:52:09 -0800 Subject: [PATCH 5/5] Remove changelog entry --- docs/source/about/changelog.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/about/changelog.rst b/docs/source/about/changelog.rst index 21b4b5eb7..6ea0fd6b0 100644 --- a/docs/source/about/changelog.rst +++ b/docs/source/about/changelog.rst @@ -100,7 +100,6 @@ Unreleased **Fixed** -- Fixed a flaky test issue in ``test_subcomponent_notation`` where react-bootstrap components would fail to initialize due to a race condition in ESM module loading from esm.sh. The fix pins esm.sh to v135 and explicitly imports react-is to ensure proper dependency resolution order. - :pull:`1239` - Fixed a bug where script elements would not render to the DOM as plain text. - :pull:`1271` - Fixed a bug where the ``key`` property provided within server-side ReactPy code was failing to propagate to the front-end JavaScript components. - :pull:`1254` - Fixed a bug where ``RuntimeError("Hook stack is in an invalid state")`` errors could be generated when using a webserver that reuses threads.