Skip to content

Commit 4b8f154

Browse files
committed
Fix breaking change
1 parent 8b916b3 commit 4b8f154

7 files changed

Lines changed: 11 additions & 13 deletions

File tree

examples/crm/src/deals/DealShow.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { CompanyAvatar } from '../companies/CompanyAvatar';
1515
import { NotesIterator } from '../notes';
1616
import { ContactList } from './ContactList';
1717
import { stageNames } from './stages';
18-
import { Deal } from '../types';
1918

2019
export const DealShow = ({ open, id }: { open: boolean; id?: string }) => {
2120
const redirect = useRedirect();
@@ -49,7 +48,7 @@ export const DealShow = ({ open, id }: { open: boolean; id?: string }) => {
4948
};
5049

5150
const DealShowContent = () => {
52-
const record = useRecordContext<Deal>();
51+
const record = useRecordContext();
5352
if (!record) return null;
5453
return (
5554
<div>

examples/crm/src/notes/NewNote.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import { Box, TextField as TextInput, Button } from '@mui/material';
1414

1515
import { StatusSelector } from './StatusSelector';
16-
import { Contact, Deal } from '../types';
1716

1817
export const NewNote = ({
1918
showStatus,
@@ -23,7 +22,7 @@ export const NewNote = ({
2322
reference: 'contacts' | 'deals';
2423
}) => {
2524
const resource = useResourceContext();
26-
const record = useRecordContext<Deal | Contact>();
25+
const record = useRecordContext();
2726
const { refetch } = useListContext();
2827
const [text, setText] = useState('');
2928
const [status, setStatus] = useState(record && record.status);

examples/crm/src/notes/Note.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import EditIcon from '@mui/icons-material/Edit';
2222
import TrashIcon from '@mui/icons-material/Delete';
2323

2424
import { Status } from '../misc/Status';
25-
import { Contact, Deal } from '../types';
2625

2726
export const Note = ({
2827
showStatus,
@@ -38,7 +37,7 @@ export const Note = ({
3837
const [isEditing, setEditing] = useState(false);
3938
const [noteText, setNoteText] = useState(note.text);
4039
const resource = useResourceContext();
41-
const record = useRecordContext<Deal | Contact>();
40+
const record = useRecordContext();
4241
const notify = useNotify();
4342

4443
const [update, { isLoading }] = useUpdate();

examples/demo/src/reviews/ReviewItem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ import {
1616
} from 'react-admin';
1717

1818
import AvatarField from '../visitors/AvatarField';
19-
import { Review, Customer } from './../types';
19+
import { Customer } from './../types';
2020

2121
export const ReviewItem = () => {
22-
const record = useRecordContext<Review>();
22+
const record = useRecordContext();
2323
const createPath = useCreatePath();
2424
if (!record) {
2525
return null;

examples/demo/src/visitors/Aside.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ const mixOrdersAndReviews = (
200200
};
201201

202202
const Order = () => {
203-
const record = useRecordContext<OrderRecord>();
203+
const record = useRecordContext();
204204
const translate = useTranslate();
205205
if (!record) return null;
206206
return (

packages/ra-core/src/controller/record/useRecordContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { RecordContext } from './RecordContext';
3030
* @returns {RaRecord} A record object
3131
*/
3232
export const useRecordContext = <
33-
RecordType extends Record<string, unknown> = Record<string, unknown>
33+
RecordType extends Record<string, unknown> = Record<string, any>
3434
>(
3535
props?: UseRecordContextParams<RecordType>
3636
): RecordType | undefined => {

packages/ra-ui-materialui/src/field/FunctionField.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { PublicFieldProps, InjectedFieldProps, fieldPropTypes } from './types';
1919
*/
2020

2121
export const FunctionField = <
22-
RecordType extends Record<string, unknown> = Record<string, unknown>
22+
RecordType extends Record<string, unknown> = Record<string, any>
2323
>(
2424
props: FunctionFieldProps<RecordType>
2525
) => {
@@ -48,8 +48,9 @@ FunctionField.propTypes = {
4848
render: PropTypes.func.isRequired,
4949
};
5050

51-
export interface FunctionFieldProps<RecordType extends unknown = any>
52-
extends PublicFieldProps,
51+
export interface FunctionFieldProps<
52+
RecordType extends Record<string, unknown> = Record<string, any>
53+
> extends PublicFieldProps,
5354
InjectedFieldProps<RecordType>,
5455
Omit<TypographyProps, 'textAlign'> {
5556
render: (record?: RecordType, source?: string) => any;

0 commit comments

Comments
 (0)