Skip to content

Commit 713f863

Browse files
authored
react: remove usage of React.ReducerAction
React 19 removed the ReducerAction type and therefore errors. We now use CoreActions directly. Fixes #2572
1 parent 2256712 commit 713f863

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

packages/material-renderers/src/layouts/ExpandPanelRenderer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React, {
33
ComponentType,
44
Dispatch,
55
Fragment,
6-
ReducerAction,
76
useMemo,
87
useState,
98
useEffect,
@@ -17,6 +16,7 @@ import {
1716
import {
1817
composePaths,
1918
ControlElement,
19+
CoreActions,
2020
findUISchema,
2121
JsonFormsRendererRegistryEntry,
2222
JsonSchema,
@@ -258,7 +258,7 @@ export const ExpandPanelRenderer = React.memo(ExpandPanelRendererComponent);
258258
* @returns {DispatchPropsOfArrayControl} dispatch props of an expand panel control
259259
*/
260260
export const ctxDispatchToExpandPanelProps: (
261-
dispatch: Dispatch<ReducerAction<any>>
261+
dispatch: Dispatch<CoreActions>
262262
) => DispatchPropsOfExpandPanel = (dispatch) => ({
263263
removeItems: useCallback(
264264
(path: string, toDelete: number[]) =>

packages/react/src/JsonFormsContext.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ import debounce from 'lodash/debounce';
8686
import React, {
8787
ComponentType,
8888
Dispatch,
89-
ReducerAction,
9089
useCallback,
9190
useContext,
9291
useEffect,
@@ -107,7 +106,7 @@ const initialCoreState: JsonFormsCore = {
107106
};
108107

109108
export interface JsonFormsStateContext extends JsonFormsSubStates {
110-
dispatch?: Dispatch<ReducerAction<typeof coreReducer>>;
109+
dispatch?: Dispatch<CoreActions>;
111110
}
112111

113112
export const JsonFormsContext = React.createContext<JsonFormsStateContext>({
@@ -276,7 +275,7 @@ export const useJsonForms = (): JsonFormsStateContext =>
276275

277276
export interface JsonFormsReduxContextProps extends JsonFormsSubStates {
278277
children: any;
279-
dispatch: Dispatch<ReducerAction<any>>;
278+
dispatch: Dispatch<CoreActions>;
280279
}
281280

282281
export const ctxToArrayLayoutProps = (
@@ -373,7 +372,7 @@ export const ctxToAllOfProps = (
373372
};
374373

375374
export const ctxDispatchToControlProps = (
376-
dispatch: Dispatch<ReducerAction<any>>
375+
dispatch: Dispatch<CoreActions>
377376
): DispatchPropsOfControl =>
378377
useMemo(() => mapDispatchToControlProps(dispatch as any), [dispatch]);
379378

@@ -409,7 +408,7 @@ export const ctxToJsonFormsRendererProps = (
409408
) => mapStateToJsonFormsRendererProps({ jsonforms: { ...ctx } }, ownProps);
410409

411410
export const ctxDispatchToArrayControlProps = (
412-
dispatch: Dispatch<ReducerAction<any>>
411+
dispatch: Dispatch<CoreActions>
413412
) => ({
414413
...ctxDispatchToControlProps(dispatch),
415414
...useMemo(() => mapDispatchToArrayControlProps(dispatch as any), [dispatch]),
@@ -473,7 +472,7 @@ export const ctxToDispatchCellProps = (
473472
};
474473

475474
export const ctxDispatchToMultiEnumProps = (
476-
dispatch: Dispatch<ReducerAction<any>>
475+
dispatch: Dispatch<CoreActions>
477476
) => ({
478477
...ctxDispatchToControlProps(dispatch),
479478
...useMemo(() => mapDispatchToMultiEnumProps(dispatch as any), [dispatch]),

0 commit comments

Comments
 (0)