Skip to content
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

[Snyk] Upgrade react-dom from 18.3.1 to 19.0.0 #58

Merged
merged 1 commit into from
Dec 29, 2024

Conversation

guibranco
Copy link
Member

@guibranco guibranco commented Dec 29, 2024

snyk-top-banner

Snyk has created this PR to upgrade react-dom from 18.3.1 to 19.0.0.

ℹ️ Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.


⚠️ Warning: This PR contains major version upgrade(s), and may be a breaking change.

  • The recommended version is 195 versions ahead of your current version.

  • The recommended version was released 23 days ago.

Release notes
Package name: react-dom
  • 19.0.0 - 2024-12-05

    Below is a list of all new features, APIs, deprecations, and breaking changes. Read React 19 release post and React 19 upgrade guide for more information.

    Note: To help make the upgrade to React 19 easier, we’ve published a [email protected] release that is identical to 18.2 but adds warnings for deprecated APIs and other changes that are needed for React 19. We recommend upgrading to React 18.3.1 first to help identify any issues before upgrading to React 19.

    New Features

    React

    • Actions: startTransition can now accept async functions. Functions passed to startTransition are called “Actions”. A given Transition can include one or more Actions which update state in the background and update the UI with one commit. In addition to updating state, Actions can now perform side effects including async requests, and the Action will wait for the work to finish before finishing the Transition. This feature allows Transitions to include side effects like fetch() in the pending state, and provides support for error handling, and optimistic updates.
    • useActionState: is a new hook to order Actions inside of a Transition with access to the state of the action, and the pending state. It accepts a reducer that can call Actions, and the initial state used for first render. It also accepts an optional string that is used if the action is passed to a form action prop to support progressive enhancement in forms.
    • useOptimistic: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.
    • use: is a new API that allows reading resources in render. In React 19, use accepts a promise or Context. If provided a promise, use will suspend until a value is resolved. use can only be used in render but can be called conditionally.
    • ref as a prop: Refs can now be used as props, removing the need for forwardRef.
    • Suspense sibling pre-warming: When a component suspends, React will immediately commit the fallback of the nearest Suspense boundary, without waiting for the entire sibling tree to render. After the fallback commits, React will schedule another render for the suspended siblings to “pre-warm” lazy requests.

    React DOM Client

    • <form> action prop: Form Actions allow you to manage forms automatically and integrate with useFormStatus. When a <form> action succeeds, React will automatically reset the form for uncontrolled components. The form can be reset manually with the new requestFormReset API.
    • <button> and <input> formAction prop: Actions can be passed to the formAction prop to configure form submission behavior. This allows using different Actions depending on the input.
    • useFormStatus: is a new hook that provides the status of the parent <form> action, as if the form was a Context provider. The hook returns the values: pending, data, method, and action.
    • Support for Document Metadata: We’ve added support for rendering document metadata tags in components natively. React will automatically hoist them into the <head> section of the document.
    • Support for Stylesheets: React 19 will ensure stylesheets are inserted into the <head> on the client before revealing the content of a Suspense boundary that depends on that stylesheet.
    • Support for async scripts: Async scripts can be rendered anywhere in the component tree and React will handle ordering and deduplication.
    • Support for preloading resources: React 19 ships with preinit, preload, prefetchDNS, and preconnect APIs to optimize initial page loads by moving discovery of additional resources like fonts out of stylesheet loading. They can also be used to prefetch resources used by an anticipated navigation.

    React DOM Server

    • Added prerender and prerenderToNodeStream APIs for static site generation. They are designed to work with streaming environments like Node.js Streams and Web Streams. Unlike renderToString, they wait for data to load for HTML generation.

    React Server Components

    • RSC features such as directives, server components, and server functions are now stable. This means libraries that ship with Server Components can now target React 19 as a peer dependency with a react-server export condition for use in frameworks that support the Full-stack React Architecture. The underlying APIs used to implement a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x. See docs for how to support React Server Components.

    Deprecations

    • Deprecated: element.ref access: React 19 supports ref as a prop, so we’re deprecating element.ref in favor of element.props.ref. Accessing will result in a warning.
    • react-test-renderer: In React 19, react-test-renderer logs a deprecation warning and has switched to concurrent rendering for web usage. We recommend migrating your tests to @ testinglibrary.com/docs/react-testing-library/intro/) or @ testingesting-library.com/docs/react-native-testing-library/intro)

    Breaking Changes

    React 19 brings in a number of breaking changes, including the removals of long-deprecated APIs. We recommend first upgrading to 18.3.1, where we've added additional deprecation warnings. Check out the upgrade guide for more details and guidance on codemodding.

    React

    • New JSX Transform is now required: We introduced a new JSX transform in 2020 to improve bundle size and use JSX without importing React. In React 19, we’re adding additional improvements like using ref as a prop and JSX speed improvements that require the new transform.
    • Errors in render are not re-thrown: Errors that are not caught by an Error Boundary are now reported to window.reportError. Errors that are caught by an Error Boundary are reported to console.error. We’ve introduced onUncaughtError and onCaughtError methods to createRoot and hydrateRoot to customize this error handling.
    • Removed: propTypes: Using propTypes will now be silently ignored. If required, we recommend migrating to TypeScript or another type-checking solution.
    • Removed: defaultProps for functions: ES6 default parameters can be used in place. Class components continue to support defaultProps since there is no ES6 alternative.
    • Removed: contextTypes and getChildContext: Legacy Context for class components has been removed in favor of the contextType API.
    • Removed: string refs: Any usage of string refs need to be migrated to ref callbacks.
    • Removed: Module pattern factories: A rarely used pattern that can be migrated to regular functions.
    • Removed: React.createFactory: Now that JSX is broadly supported, all createFactory usage can be migrated to JSX components.
    • Removed: react-test-renderer/shallow: This has been a re-export of react-shallow-renderer since React 18. If needed, you can continue to use the third-party package directly. We recommend using @ testinglibrary.com/docs/react-testing-library/intro/) or @ testingesting-library.com/docs/react-native-testing-library/intro) instead.

    React DOM

    • Removed: react-dom/test-utils: We’ve moved act from react-dom/test-utils to react. All other utilities have been removed.
    • Removed: ReactDOM.render, ReactDOM.hydrate: These have been removed in favor of the concurrent equivalents: ReactDOM.createRoot and ReactDOM.hydrateRoot.
    • Removed: unmountComponentAtNode: Removed in favor of root.unmount().
    • Removed: ReactDOM.findDOMNode: You can replace ReactDOM.findDOMNode with DOM Refs.

    Notable Changes

    React

    • <Context> as a provider: You can now render <Context> as a provider instead of <Context.Provider>.
    • Cleanup functions for refs: When the component unmounts, React will call the cleanup function returned from the ref callback.
    • useDeferredValue initial value argument: When provided, useDeferredValue will return the initial value for the initial render of a component, then schedule a re-render in the background with the deferredValue returned.
    • Support for Custom Elements: React 19 now passes all tests on Custom Elements Everywhere.
    • StrictMode changes: useMemo and useCallback will now reuse the memoized results from the first render, during the second render. Additionally, StrictMode will now double-invoke ref callback functions on initial mount.
    • UMD builds removed: To load React 19 with a script tag, we recommend using an ESM-based CDN such as esm.sh.

    React DOM

    • Diffs for hydration errors: In the case of a mismatch, React 19 logs a single error with a diff of the mismatched content.
    • Compatibility with third-party scripts and extensions: React will now force a client re-render to fix up any mismatched content caused by elements inserted by third-party JS.

    TypeScript Changes

    The most common changes can be codemodded with npx types-react-codemod@latest preset-19 ./path-to-your-react-ts-files.

    • Removed deprecated TypeScript types:
      • ReactChild (replacement: React.ReactElement | number | string)
      • ReactFragment (replacement: Iterable<React.ReactNode>)
      • ReactNodeArray (replacement: ReadonlyArray<React.ReactNode>)
      • ReactText (replacement: number | string)
      • VoidFunctionComponent (replacement: FunctionComponent)
      • VFC (replacement: FC)
      • Moved to prop-types: Requireable, ValidationMap, Validator, WeakValidationMap
      • Moved to create-react-class: ClassicComponentClass, ClassicComponent, ClassicElement, ComponentSpec, Mixin, ReactChildren, ReactHTML, ReactSVG, SFCFactory
    • Disallow implicit return in refs: refs can now accept cleanup functions. When you return something else, we can’t tell if you intentionally returned something not meant to clean up or returned the wrong value. Implicit returns of anything but functions will now error.
    • Require initial argument to useRef: The initial argument is now required to match useState, createContext etc
    • Refs are mutable by default: Ref objects returned from useRef() are now always mutable instead of sometimes being immutable. This feature was too confusing for users and conflicted with legit cases where refs were managed by React and manually written to.
    • Strict ReactElement typing: The props of React elements now default to unknown instead of any if the element is typed as ReactElement
    • JSX namespace in TypeScript: The global JSX namespace is removed to improve interoperability with other libraries using JSX. Instead, the JSX namespace is available from the React package: import { JSX } from 'react'
    • Better useReducer typings: Most useReducer usage should not require explicit type arguments.
      For example,
      -useReducer<React.Reducer<State, Action>>(reducer)  
      +useReducer(reducer)  
      or
      -useReducer<React.Reducer<State, Action>>(reducer)  
      +useReducer<State, [Action]>(reducer)

    All Changes

    React

    React DOM

Snyk has created this PR to upgrade react-dom from 18.3.1 to 19.0.0.

See this package in npm:
react-dom

See this project in Snyk:
https://app.snyk.io/org/guibranco/project/4ceee1b0-3784-4f5e-ba25-58af15f5438e?utm_source=github&utm_medium=referral&page=upgrade-pr
Copy link

semanticdiff-com bot commented Dec 29, 2024

Review changes with  SemanticDiff

Changed Files
File Status
  PocSplitUpload/ClientApp/package.json  0% smaller

Copy link

pr-code-reviewer bot commented Dec 29, 2024

👋 Hi there!

Everything looks good!


Automatically generated with the help of gpt-3.5-turbo.
Feedback? Please don't hesitate to drop me an email at [email protected].

Copy link

sourcery-ai bot commented Dec 29, 2024

Reviewer's Guide by Sourcery

This PR upgrades react-dom from version 18.3.1 to 19.0.0. This is a major version upgrade and may introduce breaking changes. React 19 introduces several new features, including Actions, useActionState, useOptimistic, use, ref as a prop, Suspense sibling pre-warming, form action prop, useFormStatus, support for document metadata, stylesheets, async scripts, and preloading resources. It also includes some deprecations and breaking changes, such as requiring the new JSX transform, changes to error handling, removal of propTypes, defaultProps for functions, contextTypes, getChildContext, string refs, module pattern factories, React.createFactory, react-test-renderer/shallow, react-dom/test-utils, ReactDOM.render, ReactDOM.hydrate, unmountComponentAtNode, and ReactDOM.findDOMNode.

Class diagram showing API changes in React 19

classDiagram
    class React {
        +use(promise)
        +startTransition(action)
        -createFactory() [removed]
    }

    class ReactDOM {
        -render() [removed]
        -hydrate() [removed]
        -findDOMNode() [removed]
        -unmountComponentAtNode() [removed]
        +createRoot()
        +hydrateRoot()
    }

    class Hooks {
        +useActionState()
        +useOptimistic()
        +useFormStatus()
        +use()
    }

    class Form {
        +action: function
        +formAction: function
        +requestFormReset()
    }

    React --> Hooks : provides
    React --> Form : provides
    ReactDOM --> Form : implements
Loading

File-Level Changes

Change Details Files
Upgraded react-dom from 18.2.0 to 19.0.0
  • Updated the react-dom dependency version in package.json
PocSplitUpload/ClientApp/package.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Potential issues, bugs, and flaws that can introduce unwanted behavior:

  1. Compatibility Concerns
    /PocSplitUpload/ClientApp/package.json - Upgrading react-dom from ^18.2.0 to ^19.0.0 could introduce breaking changes that are incompatible with the current versions of other packages, particularly react, react-router-dom, and any other dependencies relying specifically on React 18.x behaviors. Comprehensive testing is required after this upgrade to ensure that no functionality is broken.

Code suggestions and improvements for better exception handling, logic, standardization, and consistency:

  1. Update Peer Dependencies
    /PocSplitUpload/ClientApp/package.json - When upgrading react-dom, consider reviewing and updating react and related libraries to ensure compatibility with the latest features and improvements in React 19.x. This may involve updating react to ^19.0.0 as well, ensuring consistency between versions.

  2. Versioning Strategy
    /PocSplitUpload/ClientApp/package.json - Consider specifying exact versions or a specific range instead of using the caret (^) if your project demands stability. This will mitigate the risk of unexpected behaviors from automatic upgrades when running package installations.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. Here's why:

  • It seems to have been created by a bot ('[Snyk]' found in title). We assume it knows what it's doing!
  • We don't review packaging changes - Let us know if you'd like us to change this.

Copy link

gooroo-dev bot commented Dec 29, 2024

Please double check the following review of the pull request:

Issues counts

🐞Mistake 🤪Typo 🚨Security 🚀Performance 💪Best Practices 📖Readability ❓Others
0 0 0 0 0 0 0

Changes in the diff

  • 🛠️ Updated the react-dom package version from ^18.2.0 to ^19.0.0 in package.json.

Identified Issues

ID Type Details Severity Confidence
1 💪Best Practices Ensure compatibility with react-dom version 19.0.0 by reviewing and testing all components that use react-dom. 🟠Medium 🟠Medium

Explanation of Identified Issues

ID 1: Compatibility with react-dom version 19.0.0

Issue Explanation:
The upgrade of react-dom from version 18.2.0 to 19.0.0 may introduce breaking changes or deprecations that could affect the application's components. It is crucial to review the release notes of react-dom version 19.0.0 and test the application thoroughly to ensure that all components function correctly with the new version.

Code to Address the Issue:
No specific code changes are required at this stage, but the following steps should be taken:

  1. Review the release notes for react-dom version 19.0.0.
  2. Run the application and conduct thorough testing of all components that interact with react-dom.
  3. Address any issues or deprecations identified during testing.

Explanation of the Fix:
By reviewing the release notes and conducting thorough testing, you can identify any potential issues introduced by the upgrade and address them accordingly. This proactive approach ensures that the application remains stable and functional after the package update.

Missing Tests for the Incoming Changes

Since the change involves updating a package version, no specific code changes have been made that require new tests. However, it is recommended to run the existing test suite to ensure that the application behaves as expected with the updated react-dom version. If any issues are identified during testing, additional tests should be created to cover those scenarios.

Summon me to re-review when updated! Yours, Gooroo.dev
I'd love to hear your thoughts! React or reply.

Copy link

coderabbitai bot commented Dec 29, 2024

Important

Review skipped

Ignore keyword(s) in the title.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've completed my review and didn't find any issues.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

Copy link

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment +2 84.2 kB

🚮 Removed packages: npm/[email protected]

View full report↗︎

@gstraccini gstraccini bot added the ☑️ auto-merge Automatic merging of pull requests (gstraccini-bot) label Dec 29, 2024
Copy link

Infisical secrets check: ✅ No secrets leaked!

Scan results:

3:28AM INF scanning for exposed secrets...
3:28AM INF 65 commits scanned.
3:28AM INF scan completed in 271ms
3:28AM INF no leaks found

Copy link

gstraccini bot commented Dec 29, 2024

This pull request is ready ✅ for merge/squash.

@guibranco guibranco merged commit f862994 into main Dec 29, 2024
19 checks passed
@guibranco guibranco deleted the snyk-upgrade-68cadf1f6548ef9243aad21c58af98ae branch December 29, 2024 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☑️ auto-merge Automatic merging of pull requests (gstraccini-bot)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants