Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 12, 2025

Description

Tests test_subcomponent_notation_as_str_attrs and test_subcomponent_notation_as_obj_attrs were failing intermittently with Cannot read properties of null (reading 'useContext'). The issue was a race condition where react-bootstrap attempted to access React's context API before its peer dependencies were fully initialized in the ESM module graph.

Fix:

  • Pin esm.sh to version 135 for deterministic CDN builds
  • Explicitly import react-is before react-bootstrap to ensure proper module loading order
  • Add comments documenting why the import is necessary
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";

Checklist

Please update this checklist as you complete each item:

  • Tests have been developed for bug fixes or new functionality.
  • The changelog has been updated, if necessary.
  • Documentation has been updated, if necessary.
  • GitHub Issues closed by this PR have been linked.

By submitting this pull request I agree that all contributions comply with this project's open source license(s).

Original prompt

Reference: https://github.com/reactive-python/reactpy/actions/runs/20151411474/job/57844821678

Determine the cause of this flaky failure and implement a solution.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits December 12, 2025 00:16
Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com>
Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com>
Co-authored-by: Archmonger <16909269+Archmonger@users.noreply.github.com>
Copilot AI changed the title [WIP] Determine cause of flaky failure and implement solution Fix flaky test: ESM module loading race condition in test_subcomponent_notation Dec 12, 2025
Copilot AI requested a review from Archmonger December 12, 2025 00:21
@Archmonger Archmonger marked this pull request as ready for review December 12, 2025 00:55
@Archmonger Archmonger merged commit 84e1246 into main Dec 12, 2025
20 checks passed
@Archmonger Archmonger deleted the copilot/fix-flaky-failure-issue branch December 12, 2025 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants