Skip to content

Update React Framework to version 19.1.0 and related testing libraries #255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link

@Copilot Copilot AI commented May 20, 2025

This PR updates the React Framework and related testing libraries to their latest versions as of May 2025. The changes maintain compatibility with the existing codebase while ensuring it works with the latest React APIs.

Major changes:

  • Updated React and React DOM from v17.0.1 to v19.1.0
  • Updated Application Insights React packages to compatible versions
  • Updated testing libraries (@testing-library/react to v16.3.0)
  • Added @testing-library/dom as a new dependency
  • Fixed component rendering to use React 18+'s createRoot API instead of ReactDOM.render
  • Added JSX namespace declaration for React 19 compatibility
  • Fixed Tooltip and Link component usage for compatibility with React 19
  • Added comprehensive documentation about the upgrade process

Notes:

  • 3 out of 4 test files now pass successfully
  • The VersionedItemsTable tests partially fail due to React 19's stricter requirements for wrapping state updates in act()
  • Build process continues to work correctly with the updated dependencies
  • Detailed documentation of the upgrade process is available in /docs/react-19-upgrade.md

Fixes #254.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link

@Copilot Copilot AI changed the title [WIP] Updating React Framework to latest (as of 2025-05-20) Update React Framework to version 19.1.0 and related testing libraries May 20, 2025
@Copilot Copilot AI requested a review from h2floh May 20, 2025 14:16
Copilot finished work on behalf of h2floh May 20, 2025 14:16
@h2floh
Copy link
Owner

h2floh commented May 20, 2025

@copilot please check and fix following linter errors from the ci build:

npx eslint -c .eslintrc.js --ext .ts 'src/**/*.ts*'


/__w/1/s/src/Tests/MultiIdentityPicker.test.tsx
  7:1  error  `@testing-library/dom` import should occur before import of `@testing-library/react`  import/order

/__w/1/s/src/VersionedItemsTable/VersionedItemsTable.tsx
  42:10  error  'Tooltip' is defined but never used  @typescript-eslint/no-unused-vars

/__w/1/s/src/react-global.d.ts
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-interface
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-object-type

✖ 4 problems (4 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

@h2floh
Copy link
Owner

h2floh commented May 20, 2025

@copilot can you please try and restart the last session, was aborted due to request limits

@copilot please check and fix following linter errors from the ci build:

npx eslint -c .eslintrc.js --ext .ts 'src/**/*.ts*'


/__w/1/s/src/Tests/MultiIdentityPicker.test.tsx
  7:1  error  `@testing-library/dom` import should occur before import of `@testing-library/react`  import/order

/__w/1/s/src/VersionedItemsTable/VersionedItemsTable.tsx
  42:10  error  'Tooltip' is defined but never used  @typescript-eslint/no-unused-vars

/__w/1/s/src/react-global.d.ts
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-interface
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-object-type

✖ 4 problems (4 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

@h2floh
Copy link
Owner

h2floh commented May 21, 2025

@copilot please try again

@copilot please check and fix following linter errors from the ci build:

npx eslint -c .eslintrc.js --ext .ts 'src/**/*.ts*'


/__w/1/s/src/Tests/MultiIdentityPicker.test.tsx
  7:1  error  `@testing-library/dom` import should occur before import of `@testing-library/react`  import/order

/__w/1/s/src/VersionedItemsTable/VersionedItemsTable.tsx
  42:10  error  'Tooltip' is defined but never used  @typescript-eslint/no-unused-vars

/__w/1/s/src/react-global.d.ts
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-interface
  6:15  error  An interface declaring no members is equivalent to its supertype  @typescript-eslint/no-empty-object-type

✖ 4 problems (4 errors, 0 warnings)
  2 errors and 0 warnings potentially fixable with the `--fix` option.

Co-authored-by: h2floh <[email protected]>
Copy link
Author

Copilot AI commented May 21, 2025

@copilot please try again

@copilot please check and fix following linter errors from the ci build:
...

I've fixed the linting errors in commit 785adf8:

  1. Reordered imports in MultiIdentityPicker.test.tsx to put @testing-library/dom before @testing-library/react
  2. Removed the unused Tooltip import from VersionedItemsTable.tsx
  3. Changed the empty JSX.Element interface to a type alias in react-global.d.ts

All ESLint errors are now resolved.

Copilot finished work on behalf of h2floh May 21, 2025 07:19
@h2floh
Copy link
Owner

h2floh commented May 21, 2025

@copilot command npm test fails now can you please investigate

Copy link
Author

Copilot AI commented May 21, 2025

@copilot command npm test fails now can you please investigate

I've fixed the test failures in commit f5efed5. The issues were related to React 19's stricter requirements for wrapping state updates in act(). I've updated all the tests to:

  1. Use React's act() function instead of react-dom/test-utils version
  2. Implement a better polling approach inside act() to wait for UI updates reliably
  3. Add proper timeout handling for longer-running tests
  4. Fix TypeScript type issues with test elements

All tests are now passing.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
46.7% Duplication on New Code (required ≤ 3%)
C Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Copilot finished work on behalf of h2floh May 21, 2025 07:57
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.

Updating React Framework to latest (as of 2025-05-20)
2 participants