Skip to content

ERA-11293 [Part 3: React 19] #1280

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

Merged
merged 1 commit into from
Apr 23, 2025
Merged

ERA-11293 [Part 3: React 19] #1280

merged 1 commit into from
Apr 23, 2025

Conversation

luixlive
Copy link
Contributor

@luixlive luixlive commented Apr 10, 2025

What does this PR do?

Upgrade React to version 19 and all the React libraries we use. As part of the migration, all prop types and forwardRef are removed.

Relevant link(s)

Where / how to start reviewing (optional)

All the changes are related to the upgrade of React and the React libraries we use.

Any background context you want to provide(if applicable)

This is the third sequential PR to move away from CRA and Webpack. The next step is upgrading Jest and finish with all the dependency updates so we can try to move to Vite ecosystem.

@luixlive luixlive marked this pull request as draft April 10, 2025 19:36
@luixlive luixlive marked this pull request as ready for review April 10, 2025 22:04
Copy link
Contributor

@gaboDev gaboDev left a comment

Choose a reason for hiding this comment

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

This one looks great, just an small detail, I don't see the RT working properly at least when adding new events 👀

@JoshuaVulcan JoshuaVulcan requested a review from Copilot April 22, 2025 03:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR upgrades React to version 19 by removing PropTypes and ref forwarding in several components as part of the migration away from CRA and Webpack. Key changes include:

  • Removal of forwardRef and associated eslint disable comments in components such as Input and MenuPopover.
  • Elimination of PropTypes, defaultProps, and propTypes definitions throughout multiple files.
  • Minor adjustments to default prop assignments and destructuring across components.

Reviewed Changes

Copilot reviewed 156 out of 157 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/DatePicker/CalendarPopper/MonthPicker/index.js Removed forwardRef from the Input component and updated prop handling.
src/DataExportModal/index.js Removed PropTypes definitions and set default prop values inline.
src/DasIcon/index.js Removed PropTypes definitions from the component.
src/CursorGpsDisplay/MenuPopover/index.js Removed forwardRef wrapping and updated the component’s prop handling.
src/ContextMenu/index.js Removed PropTypes definitions and relied on default parameter values.
src/ColumnSort/index.js Removed PropTypes and updated default prop values.
src/ClustersLayer/index.js Removed PropTypes from the component.
src/Checkmark/index.js Removed defaultProps and PropTypes for CheckMark.
src/CheckboxList/index.js Removed PropTypes from the component.
src/CheckableList/index.js Refactored component props and removed PropTypes definitions.
src/AnalyzerLayerList/index.js Removed PropTypes for the map prop and updated default parameters.
src/AlertsModal/index.js Removed PropTypes from the AlertsModal component.
src/AddToPatrolModal/index.js Removed PropTypes from the component.
src/AddToIncidentModal/index.js Removed PropTypes from the component.
src/AddNoteButton/index.js Removed defaultProps and PropTypes definitions, setting defaults inline.
src/AddItemButton/AddItemModal/index.js Removed PropTypes from the modal component.
src/AddItemButton/AddItemModal/TypesList/index.js Removed forwardRef and PropTypes from the TypesList component.
src/AddItemButton/AddItemModal/AddPatrolTab/index.js Removed PropTypes from the component.
src/AddAttachmentButton/index.js Removed defaultProps and PropTypes definitions from the component.
Files not reviewed (1)
  • package.json: Language not supported

Comment on lines +13 to +23
const Input = ({
className,
date,
isMonthCalendarOpen,
onClick,
// We ignore the react-datepicker internals for the keydown event and just handle the Escape ourselves.
onKeyDown: _onKeyDown,
ref,
setIsMonthCalendarOpen,
...otherProps
}, ref) => {
}) => {
Copy link
Preview

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

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

The 'ref' prop is still being accepted even though forwardRef has been removed, which may lead to confusion about ref usage. Consider removing or renaming this prop if it’s no longer used for ref forwarding.

Copilot uses AI. Check for mistakes.

@@ -12,7 +12,7 @@ import GpsInput from '../../GpsInput';

import * as styles from './styles.module.scss';

const MenuPopover = ({ buttonRef, className, onClose, ...otherProps }, ref) => {
const MenuPopover = ({ buttonRef, className, onClose, ref, ...otherProps }) => {
Copy link
Preview

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

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

Removing forwardRef changes how refs are handled. Verify that consumers of MenuPopover do not rely on ref forwarding and adjust the usage if necessary.

Suggested change
const MenuPopover = ({ buttonRef, className, onClose, ref, ...otherProps }) => {
const MenuPopover = React.forwardRef(({ buttonRef, className, onClose, ...otherProps }, ref) => {

Copilot uses AI. Check for mistakes.

@@ -17,7 +16,7 @@ const CategoryList = ({ category, onClickType, showTitle }) => <div>
</ul>
</div>;

const TypesList = ({ filterText, onClickType, typesByCategory }, ref) => {
const TypesList = ({ filterText, onClickType, ref, typesByCategory }) => {
Copy link
Preview

Copilot AI Apr 22, 2025

Choose a reason for hiding this comment

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

Avoid using 'ref' as a regular prop name since it conflicts with the reserved React ref. Consider renaming it to a more descriptive term if ref forwarding is not required.

Suggested change
const TypesList = ({ filterText, onClickType, ref, typesByCategory }) => {
const TypesList = ({ filterText, onClickType, containerRef, typesByCategory }) => {

Copilot uses AI. Check for mistakes.

Base automatically changed from ERA-11293-update-ejected-dependencies to ERA-11293 April 22, 2025 20:22
@luixlive
Copy link
Contributor Author

@gaboDev RT is working properly now. Feel free to give it another pass!

Copilot comments don't seem very accurate 🤔 It doesn't like the changes to the forwardRef but I don't really get what it wants me to do. I followed the migration recommedations.

@luixlive luixlive requested a review from gaboDev April 23, 2025 15:11
Copy link
Contributor

@gaboDev gaboDev left a comment

Choose a reason for hiding this comment

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

Looking great 🫡

@luixlive luixlive merged commit ddeeecc into ERA-11293 Apr 23, 2025
3 checks passed
@luixlive luixlive deleted the ERA-11293-react-19 branch April 23, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants