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

fix: bumping plate packages and react version to 18 [TOL-2415] #1756

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- run:
name: Run cypress component tests
command: |
TESTFILES=$(circleci tests glob cypress/component/**/*.ts | circleci tests split --split-by=timings --timings-type=filename | tr '\n' ',')
TESTFILES=$(circleci tests glob cypress/component/**/*.ts | circleci tests split --split-by=timings --timings-type=filename | awk '{if (NR>1) printf ","; printf "%s", $0} END {if (NR>0) printf " "}')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a known issue with cypress, if you end a CSV with a comma the cypress command ignores it and runs everything, we are actually running all tests but now in 3 containers instead of splitting

npx cypress run --component \
--spec "${TESTFILES}" \
--reporter junit \
Expand Down
4 changes: 2 additions & 2 deletions apps/entry-app-collapsible/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@contentful/field-editor-single-line": "^0.15.6",
"emotion": "^10.0.17",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-sortable-hoc": "^2.0.0"
},
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions apps/markdown-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"@contentful/field-editor-markdown": "^0.17.1",
"@contentful/field-editor-shared": "^0.25.1",
"@contentful/field-editor-single-line": "^0.15.6",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"scripts": {
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions apps/multiple-references-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"@contentful/f36-tokens": "^4.0.0",
"@contentful/field-editor-reference": "^2.21.2",
"@contentful/field-editor-single-line": "^0.15.6",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"scripts": {
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions apps/rich-text-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"@contentful/f36-tokens": "^4.0.0",
"@contentful/field-editor-rich-text": "^3.4.21",
"@contentful/field-editor-single-line": "^1.2.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"scripts": {
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start",
Expand Down
4 changes: 2 additions & 2 deletions apps/singleline-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"@contentful/f36-components": "^4.0.27",
"@contentful/f36-tokens": "^4.0.0",
"@contentful/field-editor-single-line": "^0.15.6",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"scripts": {
"start": "cross-env SKIP_PREFLIGHT_CHECK=true BROWSER=none react-scripts start",
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
"mocha": "10.6.0",
"prettier": "2.7.1",
"process": "0.11.10",
"react": "17.0.2",
"react-dom": "17.0.2",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-markdown": "8.0.7",
"remark-cli": "12.0.0",
"remark-gfm": "3.0.1",
Expand All @@ -125,10 +125,10 @@
"webpack": "5.94.0"
},
"resolutions": {
"@types/react": "16.14.5",
"@types/react": "18.3.1",
"babel-preset-react-app": "9.1.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"@contentful/app-sdk": "4.29.0",
"@contentful/rich-text-types": "16.7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/_shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
},
"peerDependencies": {
"@contentful/app-sdk": "^4.29.0",
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
3 changes: 2 additions & 1 deletion packages/_shared/src/ModalDialogLauncher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function open(componentRenderer: (params: { onClose: Function; isShown: b
let currentConfig = { onClose, isShown: true };

function render({ onClose, isShown }: { onClose: Function; isShown: boolean }) {
// eslint-disable-next-line -- TODO: use createRoot instead here
ReactDOM.render(componentRenderer({ onClose, isShown }), getRoot());
}

Expand All @@ -44,7 +45,7 @@ export function open(componentRenderer: (params: { onClose: Function; isShown: b

export function openDialog<T>(
options: OpenCustomWidgetOptions,
Component: React.SFC<{ onClose: (result: T) => void }>
Component: React.FC<{ onClose: (result: T) => void }>
) {
const key = Date.now();
const size = isNumber(options.width) ? `${options.width}px` : options.width;
Expand Down
2 changes: 1 addition & 1 deletion packages/_test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"peerDependencies": {
"@contentful/app-sdk": "^4.29.0",
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/boolean/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/date/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"timezoned-date": "^3.0.2"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/date/src/TimepickerInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const TimepickerInput = ({
setSelectedTime(e.currentTarget.value);
}, []);

const handleFocus = useCallback((e) => {
const handleFocus = useCallback((e: React.FocusEvent<HTMLInputElement>) => {
e.preventDefault();
e.target.select();
}, []);
Expand Down
2 changes: 1 addition & 1 deletion packages/default-field-editors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/dropdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"contentful-management": "^11.0.0"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/location/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
"peerDependencies": {
"@contentful/app-sdk": "^4.29.0",
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/multiple-line/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/number/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@testing-library/user-event": "^13.1.9"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/radio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"contentful-management": "^11.0.0"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/rating/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"@contentful/field-editor-test-utils": "^1.5.1"
},
"peerDependencies": {
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
2 changes: 1 addition & 1 deletion packages/reference/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
},
"peerDependencies": {
"@contentful/app-sdk": "^4.29.0",
"react": ">=16.8.0"
"react": ">=18.3.1"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
12 changes: 8 additions & 4 deletions packages/reference/src/common/MultipleReferenceEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { useCallback } from 'react';
import { DragStartEvent } from '@dnd-kit/core';
import { arrayMove } from '@dnd-kit/sortable';

import { LinkEntityActions } from '../components';
import { LinkActionsProps, LinkEntityActions } from '../components';
import { useLinkActionsProps } from '../components/LinkActions/LinkEntityActions';
import { ReferenceValue, ContentEntityType, ContentType } from '../types';
import { useSortIDs } from '../utils/useSortIDs';
import { CustomEntityCardProps } from './customCardTypes';
import { CustomEntityCardProps, DefaultCardRenderer } from './customCardTypes';
import { ReferenceEditor, ReferenceEditorProps } from './ReferenceEditor';
import { useEditorPermissions } from './useEditorPermissions';

Expand Down Expand Up @@ -69,7 +69,7 @@ function Editor(props: EditorProps) {
}, []);

const onSortEnd = useCallback(
({ oldIndex, newIndex }) => {
({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {
// custom callback that is invoked *before* we sort the array
// e.g. in Compose we want to sort the references in the referenceMap before re-rendering drag and drop
onSortingEnd && onSortingEnd({ oldIndex, newIndex });
Expand Down Expand Up @@ -110,7 +110,11 @@ function Editor(props: EditorProps) {
});

const customCardRenderer = useCallback(
(cardProps: CustomEntityCardProps, _, renderDefaultCard) =>
(
cardProps: CustomEntityCardProps,
_: LinkActionsProps,
renderDefaultCard: DefaultCardRenderer
) =>
props.renderCustomCard
? props.renderCustomCard(cardProps, linkActionsProps, renderDefaultCard)
: false,
Expand Down
10 changes: 7 additions & 3 deletions packages/reference/src/common/SingleReferenceEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as React from 'react';
import { useCallback } from 'react';

import { LinkEntityActions } from '../components';
import { LinkActionsProps, LinkEntityActions } from '../components';
import { useLinkActionsProps } from '../components/LinkActions/LinkEntityActions';
import { ContentType, ContentEntityType, ReferenceValue } from '../types';
import { CustomEntityCardProps } from './customCardTypes';
import { CustomEntityCardProps, DefaultCardRenderer } from './customCardTypes';
import { ReferenceEditor, ReferenceEditorProps } from './ReferenceEditor';
import { useEditorPermissions } from './useEditorPermissions';

Expand Down Expand Up @@ -49,7 +49,11 @@ function Editor(props: EditorProps) {
});
// Inject card actions props into the given custom card renderer
const customCardRenderer = useCallback(
(cardProps: CustomEntityCardProps, _, renderDefaultCard) =>
(
cardProps: CustomEntityCardProps,
_: LinkActionsProps,
renderDefaultCard: DefaultCardRenderer
) =>
props.renderCustomCard
? props.renderCustomCard(cardProps, linkActionsProps, renderDefaultCard)
: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ function ResourceEditor(props: EditorProps) {

const onSortStart = () => noop();
const onSortEnd = useCallback(
({ oldIndex, newIndex }) => {
({ oldIndex, newIndex }: { oldIndex: number; newIndex: number }) => {
const newItems = arrayMove(items, oldIndex, newIndex);
setValue(newItems);
},
[items, setValue]
);
const onMove = useCallback(
(oldIndex, newIndex) => {
(oldIndex: number, newIndex: number) => {
const newItems = arrayMove(items, oldIndex, newIndex);
setValue(newItems);
},
[items, setValue]
);

const onRemoteItemAtIndex = useCallback(
(index) => {
(index: number) => {
setValue(items.filter((_v, i) => i !== index));
},
[items, setValue]
Expand Down
30 changes: 15 additions & 15 deletions packages/rich-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@
"@contentful/rich-text-plain-text-renderer": "^16.0.4",
"@contentful/rich-text-types": "16.7.0",
"@popperjs/core": "^2.11.5",
"@udecode/plate-basic-marks": "30.1.2",
"@udecode/plate-break": "30.1.2",
"@udecode/plate-common": "30.1.2",
"@udecode/plate-core": "30.1.2",
"@udecode/plate-list": "30.1.2",
"@udecode/plate-paragraph": "30.1.2",
"@udecode/plate-reset-node": "30.1.2",
"@udecode/plate-select": "30.1.2",
"@udecode/plate-serializer-docx": "30.1.2",
"@udecode/plate-serializer-html": "30.1.2",
"@udecode/plate-table": "30.1.2",
"@udecode/plate-trailing-block": "30.1.2",
"@udecode/plate-basic-marks": "36.0.0",
"@udecode/plate-break": "36.0.0",
"@udecode/plate-common": "36.5.9",
"@udecode/plate-core": "36.5.9",
"@udecode/plate-list": "36.0.0",
"@udecode/plate-paragraph": "36.0.0",
"@udecode/plate-reset-node": "36.0.0",
"@udecode/plate-select": "36.0.0",
"@udecode/plate-serializer-docx": "36.0.10",
"@udecode/plate-serializer-html": "36.0.0",
"@udecode/plate-table": "36.5.9",
"@udecode/plate-trailing-block": "36.0.0",
"constate": "^3.3.2",
"fast-deep-equal": "^3.1.3",
"is-hotkey": "^0.2.0",
Expand All @@ -72,16 +72,16 @@
"slate-react": "0.102.0"
},
"peerDependencies": {
"react": ">=16.14.0",
"react-dom": ">=16.14.0"
"react": ">=18.3.1",
"react-dom": ">=17.0.2"
},
"devDependencies": {
"@contentful/field-editor-test-utils": "^1.5.1",
"@contentful/rich-text-react-renderer": "^15.16.4",
"@types/is-hotkey": "^0.1.6",
"@udecode/plate-test-utils": "^3.2.0",
"prism-react-renderer": "2.4.0",
"react": ">=16.14.0"
"react": "17.0.2"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
Expand Down
Loading
Loading