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

[WIP] FEC-156: migration to React 19 #3687

Draft
wants to merge 49 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
182b908
chore: ground work
kark Jan 9, 2025
cabd394
chore: uikit packages
kark Jan 9, 2025
178d507
refactor: updates resulting from uikit changes
kark Jan 9, 2025
30e2253
chore: initial changeset
kark Jan 9, 2025
01a8dc8
chore: react hooks
kark Jan 9, 2025
bf343b7
fix: further default props occurrences
kark Jan 9, 2025
f3eaaa0
fix: type errors
kark Jan 9, 2025
0626b3d
fix: improve types
kark Jan 10, 2025
a1acdb9
fix: icon type
kark Jan 10, 2025
fbd4b78
chore: use new uikit rc
kark Jan 14, 2025
4095d04
chore: cleanup
kark Jan 14, 2025
d191409
fix: custom view loading
kark Jan 14, 2025
314fd03
fix: types in starter templates
kark Jan 14, 2025
bbd51b9
fix: tests
kark Jan 14, 2025
a01a982
chore: use strict mode in playground
kark Jan 14, 2025
26c9817
chore: use tag for uikit packages
kark Jan 14, 2025
8a4addd
fix: failing credentials storage tests
kark Jan 14, 2025
f283092
fix: use skiplibcheck temporarily
kark Jan 14, 2025
43b7296
fix: try react-modal patch
kark Jan 16, 2025
41401a9
fix: channel details tests
kark Jan 16, 2025
6dc0289
fix: pagination
kark Jan 16, 2025
fa6cfdb
chore: test utils
kark Jan 16, 2025
852195f
chore: use new tag
kark Jan 17, 2025
5f4c60f
chore: cleanup resolutions
kark Jan 20, 2025
711c5b3
chore: 0.0.0-fec-155-react-19-20250122162343
kark Jan 23, 2025
b901953
chore: react-intl 7.x
kark Jan 23, 2025
50aa17b
chore: skiplibcheck
kark Jan 27, 2025
7d052d6
fix: missing key prop
kark Jan 27, 2025
08b5c1f
fix: act warnings
kark Jan 27, 2025
bfe7ef6
Merge branch 'main' into preview/fec-156-react19
CarlosCortizasCT Jan 28, 2025
9f2fe3c
Merge branch 'main' into preview/fec-156-react19
CarlosCortizasCT Jan 28, 2025
7ca60f6
Merge branch 'main' into preview/fec-156-react19
CarlosCortizasCT Jan 30, 2025
142982e
refactor: change uikit dependencies to use the dist tag instead of a …
CarlosCortizasCT Jan 30, 2025
08dcab9
Merge branch 'main' into preview/fec-156-react19
ragafus Jan 31, 2025
3df5c48
fix: wrong @commercetools-frontend/application-components peerDepende…
ragafus Feb 3, 2025
87405b1
fix: wrong pnpm version
ragafus Feb 3, 2025
48cceca
fix: typecheck errors
ragafus Feb 4, 2025
9112ead
Merge branch 'main' into preview/fec-156-react19
ragafus Feb 5, 2025
0e96026
fix: typecheck errors due to @emotion/react version
ragafus Feb 6, 2025
23e0763
refactor: remove react-modal patch
ragafus Feb 6, 2025
b7e848c
refactor: downgrade @emotion/react to 11.13.5
ragafus Feb 6, 2025
45df190
Merge branch 'main' into preview/fec-156-react19
ragafus Feb 11, 2025
87a1843
refactor: import the JSX namespace
ragafus Feb 11, 2025
c9e8f4b
refactor: remove unnecessary castings
ragafus Feb 11, 2025
d4d04d8
fix: match emotion related comments with the ones existing in main
ragafus Feb 11, 2025
ac7e93f
fix: application-components and application-shell to use app-kit 22.42.0
ragafus Feb 11, 2025
fb36583
Merge branch 'main' into preview/fec-156-react19
ragafus Feb 17, 2025
26ef3eb
fix: missing @commercetools-local/visual-testing-app dependencies
ragafus Feb 17, 2025
6e45666
Merge branch 'main' into preview/fec-156-react19
ragafus Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .changeset/heavy-flowers-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
'@commercetools-applications/merchant-center-custom-view-template-starter-typescript': major
'@commercetools-applications/merchant-center-template-starter-typescript': major
'@commercetools-frontend/application-shell-connectors': major
'@commercetools-frontend/application-components': major
'@commercetools-applications/merchant-center-custom-view-template-starter': major
'@commercetools-applications/merchant-center-template-starter': major
'@commercetools-website/components-playground': major
'@commercetools-frontend/react-notifications': major
'@commercetools-frontend/application-config': major
'@commercetools-frontend/jest-preset-mc-app': major
'@commercetools-frontend/application-shell': major
'@commercetools-frontend/actions-global': major
'@commercetools-frontend/permissions': major
'@commercetools-local/visual-testing-app': major
'@commercetools-frontend/sentry': major
'@commercetools-frontend/i18n': major
'@commercetools-frontend/l10n': major
'@commercetools-frontend/sdk': major
'@commercetools-local/playground': major
'@commercetools-backend/eslint-config-node': major
'@commercetools-backend/express': major
'@commercetools-backend/loggers': major
'@commercetools-frontend/assets': major
'@commercetools-frontend/babel-preset-mc-app': major
'@commercetools-frontend/browser-history': major
'@commercetools-frontend/codemod': major
'@commercetools-frontend/constants': major
'@commercetools-frontend/create-mc-app': major
'@commercetools-frontend/cypress': major
'@commercetools-frontend/eslint-config-mc-app': major
'@commercetools-frontend/jest-stylelint-runner': major
'@commercetools-frontend/mc-dev-authentication': major
'@commercetools-frontend/mc-html-template': major
'@commercetools-frontend/mc-scripts': major
'@commercetools-frontend/notifications': major
'@commercetools-frontend/url-utils': major
---

Upgrade to React 19
57 changes: 27 additions & 30 deletions application-templates/starter-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,34 @@
"@commercetools-test-data/channel": "8.5.0",
"@commercetools-test-data/commons": "8.5.0",
"@commercetools-test-data/core": "8.5.0",
"@commercetools-uikit/constraints": "^19.17.1",
"@commercetools-uikit/data-table": "^19.17.1",
"@commercetools-uikit/flat-button": "^19.17.1",
"@commercetools-uikit/grid": "^19.17.1",
"@commercetools-uikit/hooks": "^19.17.1",
"@commercetools-uikit/icons": "^19.17.1",
"@commercetools-uikit/link": "^19.17.1",
"@commercetools-uikit/loading-spinner": "^19.17.1",
"@commercetools-uikit/localized-text-field": "^19.17.1",
"@commercetools-uikit/localized-text-input": "^19.17.1",
"@commercetools-uikit/notifications": "^19.17.1",
"@commercetools-uikit/pagination": "^19.17.1",
"@commercetools-uikit/select-field": "^19.17.1",
"@commercetools-uikit/spacings": "^19.17.1",
"@commercetools-uikit/text": "^19.17.1",
"@commercetools-uikit/text-field": "^19.17.1",
"@commercetools-uikit/text-input": "^19.17.1",
"@commercetools-uikit/constraints": "fec-155-react-19",
"@commercetools-uikit/data-table": "fec-155-react-19",
"@commercetools-uikit/flat-button": "fec-155-react-19",
"@commercetools-uikit/grid": "fec-155-react-19",
"@commercetools-uikit/hooks": "fec-155-react-19",
"@commercetools-uikit/icons": "fec-155-react-19",
"@commercetools-uikit/link": "fec-155-react-19",
"@commercetools-uikit/loading-spinner": "fec-155-react-19",
"@commercetools-uikit/localized-text-field": "fec-155-react-19",
"@commercetools-uikit/localized-text-input": "fec-155-react-19",
"@commercetools-uikit/notifications": "fec-155-react-19",
"@commercetools-uikit/pagination": "fec-155-react-19",
"@commercetools-uikit/select-field": "fec-155-react-19",
"@commercetools-uikit/spacings": "fec-155-react-19",
"@commercetools-uikit/text": "fec-155-react-19",
"@commercetools-uikit/text-field": "fec-155-react-19",
"@commercetools-uikit/text-input": "fec-155-react-19",
"@commercetools/sync-actions": "^5.14.0",
"@emotion/react": "^11.11.4",
"@emotion/react": "^11.14.0",
Copy link
Member

Choose a reason for hiding this comment

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

@ragafus I suggest to downgrade to 11.13.5 as there are some TS errors in 11.14.0.
We are working on a fix: #3722

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this comment is not longer needed as the fix was already released and this branch refreshed with the corresponding version.

@emmenko can we close this comment?

"@formatjs/cli": "6.2.12",
"@jest/types": "29.6.3",
"@manypkg/cli": "0.21.4",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "16.1.0",
"@types/jest": "^29.5.4",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.19",
"@types/react": "^19.0.3",
"@types/react-dom": "^19.0.2",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/testing-library__jest-dom": "^5.14.9",
Expand All @@ -85,20 +84,18 @@
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^6.4.7",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-intl": "^7.1.4",
"react-redux": "7.2.9",
"react-router-dom": "5.3.4",
"redux": "4.2.1",
"typescript": "5.0.4"
},
"resolutions": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.11.0",
"@types/eslint": "<9",
"@types/react": "<18",
"@types/react-dom": "<18",
"@types/react-router": "<6",
"@types/react-router-dom": "<6",
"headers-polyfill": "3.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type TChannelDetailsFormProps = {
initialValues: TFormValues;
isReadOnly: boolean;
dataLocale: string;
children: (formProps: FormProps) => JSX.Element;
children: (formProps: FormProps) => React.JSX.Element;
};

const getRoleOptions = Object.keys(CHANNEL_ROLES).map((key) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,7 @@ describe('notifications', () => {
fireEvent.focus(rolesSelect);
fireEvent.keyDown(rolesSelect, { key: 'ArrowDown' });
const inventorySupplyOption = await screen.findByText('InventorySupply');

inventorySupplyOption.click();
fireEvent.click(inventorySupplyOption);
expect(screen.getByDisplayValue(/InventorySupply/i)).toBeInTheDocument();

// updating channel details
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useIntl } from 'react-intl';
import { useParams } from 'react-router-dom';
import type { FormikHelpers } from 'formik';
import {
PageNotFound,
FormModalPage,
Expand All @@ -19,6 +20,7 @@ import {
type TApiErrorNotificationOptions,
} from '@commercetools-frontend/actions-global';
import { PERMISSIONS } from '../../constants';
import type { TFormValues } from '../../types';
import {
useChannelDetailsUpdater,
useChannelDetailsFetcher,
Expand Down Expand Up @@ -48,7 +50,10 @@ const ChannelDetails = (props: TChannelDetailsProps) => {
const showApiErrorNotification = useShowApiErrorNotification();
const channelDetailsUpdater = useChannelDetailsUpdater();
const handleSubmit = useCallback(
async (formikValues, formikHelpers) => {
async (
formikValues: TFormValues,
formikHelpers: FormikHelpers<TFormValues>
) => {
const data = formValuesToDoc(formikValues);
try {
await channelDetailsUpdater.execute({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const Channels = (props: TChannelsProps) => {
perPage={perPage.value}
onPerPageChange={perPage.onChange}
totalItems={channelsPaginatedResult.total}
perPageRange="s"
/>
<Switch>
<SuspendedRoute path={`${match.url}/:id`}>
Expand Down
6 changes: 4 additions & 2 deletions application-templates/starter-typescript/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// <reference types="@commercetools-frontend/application-config/client" />

import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import EntryPoint from './components/entry-point';

ReactDOM.render(<EntryPoint />, document.getElementById('app'));
const container = document.getElementById('app');
const root = createRoot(container as Element);
root.render(<EntryPoint />);
57 changes: 27 additions & 30 deletions application-templates/starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,34 @@
"@commercetools-test-data/channel": "8.5.0",
"@commercetools-test-data/commons": "8.5.0",
"@commercetools-test-data/core": "8.5.0",
"@commercetools-uikit/constraints": "^19.17.1",
"@commercetools-uikit/data-table": "^19.17.1",
"@commercetools-uikit/flat-button": "^19.17.1",
"@commercetools-uikit/grid": "^19.17.1",
"@commercetools-uikit/hooks": "^19.17.1",
"@commercetools-uikit/icons": "^19.17.1",
"@commercetools-uikit/link": "^19.17.1",
"@commercetools-uikit/loading-spinner": "^19.17.1",
"@commercetools-uikit/localized-text-field": "^19.17.1",
"@commercetools-uikit/localized-text-input": "^19.17.1",
"@commercetools-uikit/notifications": "^19.17.1",
"@commercetools-uikit/pagination": "^19.17.1",
"@commercetools-uikit/select-field": "^19.17.1",
"@commercetools-uikit/spacings": "^19.17.1",
"@commercetools-uikit/text": "^19.17.1",
"@commercetools-uikit/text-field": "^19.17.1",
"@commercetools-uikit/text-input": "^19.17.1",
"@commercetools-uikit/constraints": "fec-155-react-19",
"@commercetools-uikit/data-table": "fec-155-react-19",
"@commercetools-uikit/flat-button": "fec-155-react-19",
"@commercetools-uikit/grid": "fec-155-react-19",
"@commercetools-uikit/hooks": "fec-155-react-19",
"@commercetools-uikit/icons": "fec-155-react-19",
"@commercetools-uikit/link": "fec-155-react-19",
"@commercetools-uikit/loading-spinner": "fec-155-react-19",
"@commercetools-uikit/localized-text-field": "fec-155-react-19",
"@commercetools-uikit/localized-text-input": "fec-155-react-19",
"@commercetools-uikit/notifications": "fec-155-react-19",
"@commercetools-uikit/pagination": "fec-155-react-19",
"@commercetools-uikit/select-field": "fec-155-react-19",
"@commercetools-uikit/spacings": "fec-155-react-19",
"@commercetools-uikit/text": "fec-155-react-19",
"@commercetools-uikit/text-field": "fec-155-react-19",
"@commercetools-uikit/text-input": "fec-155-react-19",
"@commercetools/sync-actions": "^5.14.0",
"@emotion/react": "^11.11.4",
"@emotion/react": "^11.14.0",
"@formatjs/cli": "6.2.12",
"@jest/types": "29.6.3",
"@manypkg/cli": "0.21.4",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "16.1.0",
"@types/jest": "^29.5.4",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.19",
"@types/react": "^19.0.3",
"@types/react-dom": "^19.0.2",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/testing-library__jest-dom": "^5.14.9",
Expand All @@ -84,19 +83,17 @@
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^6.4.7",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-intl": "^7.1.4",
"react-redux": "7.2.9",
"react-router-dom": "5.3.4",
"redux": "4.2.1"
},
"resolutions": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.11.0",
"@types/eslint": "<9",
"@types/react": "<18",
"@types/react-dom": "<18",
"@types/react-router": "<6",
"@types/react-router-dom": "<6",
"headers-polyfill": "3.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ describe('notifications', () => {
});
fireEvent.focus(rolesSelect);
fireEvent.keyDown(rolesSelect, { key: 'ArrowDown' });
screen.getByText('InventorySupply').click();
const inventorySupplyOption = screen.getByText('InventorySupply');
fireEvent.click(inventorySupplyOption);
expect(screen.getByDisplayValue(/InventorySupply/i)).toBeInTheDocument();

// updating channel details
Expand Down
6 changes: 4 additions & 2 deletions application-templates/starter/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import EntryPoint from './components/entry-point';

ReactDOM.render(<EntryPoint />, document.getElementById('app'));
const container = document.getElementById('app');
const root = createRoot(container);
root.render(<EntryPoint />);
57 changes: 27 additions & 30 deletions custom-views-templates/starter-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,35 +40,34 @@
"@commercetools-test-data/channel": "8.5.0",
"@commercetools-test-data/commons": "8.5.0",
"@commercetools-test-data/core": "8.5.0",
"@commercetools-uikit/constraints": "^19.17.1",
"@commercetools-uikit/data-table": "^19.17.1",
"@commercetools-uikit/flat-button": "^19.17.1",
"@commercetools-uikit/grid": "^19.17.1",
"@commercetools-uikit/hooks": "^19.17.1",
"@commercetools-uikit/icons": "^19.17.1",
"@commercetools-uikit/link": "^19.17.1",
"@commercetools-uikit/loading-spinner": "^19.17.1",
"@commercetools-uikit/localized-text-field": "^19.17.1",
"@commercetools-uikit/localized-text-input": "^19.17.1",
"@commercetools-uikit/notifications": "^19.17.1",
"@commercetools-uikit/pagination": "^19.17.1",
"@commercetools-uikit/select-field": "^19.17.1",
"@commercetools-uikit/spacings": "^19.17.1",
"@commercetools-uikit/text": "^19.17.1",
"@commercetools-uikit/text-field": "^19.17.1",
"@commercetools-uikit/text-input": "^19.17.1",
"@commercetools-uikit/constraints": "fec-155-react-19",
"@commercetools-uikit/data-table": "fec-155-react-19",
"@commercetools-uikit/flat-button": "fec-155-react-19",
"@commercetools-uikit/grid": "fec-155-react-19",
"@commercetools-uikit/hooks": "fec-155-react-19",
"@commercetools-uikit/icons": "fec-155-react-19",
"@commercetools-uikit/link": "fec-155-react-19",
"@commercetools-uikit/loading-spinner": "fec-155-react-19",
"@commercetools-uikit/localized-text-field": "fec-155-react-19",
"@commercetools-uikit/localized-text-input": "fec-155-react-19",
"@commercetools-uikit/notifications": "fec-155-react-19",
"@commercetools-uikit/pagination": "fec-155-react-19",
"@commercetools-uikit/select-field": "fec-155-react-19",
"@commercetools-uikit/spacings": "fec-155-react-19",
"@commercetools-uikit/text": "fec-155-react-19",
"@commercetools-uikit/text-field": "fec-155-react-19",
"@commercetools-uikit/text-input": "fec-155-react-19",
"@commercetools/sync-actions": "^5.14.0",
"@emotion/react": "^11.11.4",
"@emotion/react": "^11.14.0",
"@formatjs/cli": "6.2.12",
"@jest/types": "29.6.3",
"@manypkg/cli": "0.21.4",
"@testing-library/dom": "^9.3.1",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "12.1.5",
"@testing-library/react-hooks": "8.0.1",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "16.1.0",
"@types/jest": "^29.5.4",
"@types/react": "^17.0.83",
"@types/react-dom": "^17.0.19",
"@types/react": "^19.0.3",
"@types/react-dom": "^19.0.2",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "^5.3.3",
"@types/testing-library__jest-dom": "^5.14.9",
Expand All @@ -85,20 +84,18 @@
"msw": "0.49.3",
"omit-empty-es": "1.2.0",
"prettier": "2.8.8",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-intl": "^6.4.7",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-intl": "^7.1.4",
"react-redux": "7.2.9",
"react-router-dom": "5.3.4",
"redux": "4.2.1",
"typescript": "5.0.4"
},
"resolutions": {
"@emotion/react": "^11.11.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.11.0",
"@types/eslint": "<9",
"@types/react": "<18",
"@types/react-dom": "<18",
"@types/react-router": "<6",
"@types/react-router-dom": "<6",
"headers-polyfill": "3.2.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ const Channels = () => {
/>
<Pagination
page={page.value}
perPageRange="s"
onPageChange={page.onChange}
perPage={perPage.value}
onPerPageChange={perPage.onChange}
Expand Down
6 changes: 4 additions & 2 deletions custom-views-templates/starter-typescript/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/// <reference types="@commercetools-frontend/application-config/client" />

import ReactDOM from 'react-dom';
import { createRoot } from 'react-dom/client';
import EntryPoint from './components/entry-point';

ReactDOM.render(<EntryPoint />, document.getElementById('app'));
const container = document.getElementById('app');
const root = createRoot(container as Element);
root.render(<EntryPoint />);
Loading
Loading