From c5fb016882a6aef4afb8f6a1450282284f914e6d Mon Sep 17 00:00:00 2001 From: fargito Date: Tue, 28 May 2019 10:50:55 +0200 Subject: [PATCH 1/6] enable linkType function for ReferenceField --- packages/ra-core/src/controller/field/useReference.ts | 9 +++++++-- packages/ra-ui-materialui/src/field/ReferenceField.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/ra-core/src/controller/field/useReference.ts b/packages/ra-core/src/controller/field/useReference.ts index baa3b3329f5..08a245331c9 100644 --- a/packages/ra-core/src/controller/field/useReference.ts +++ b/packages/ra-core/src/controller/field/useReference.ts @@ -7,6 +7,8 @@ import { crudGetManyAccumulate } from '../../actions'; import { linkToRecord } from '../../util'; import { Record, ReduxState } from '../../types'; +type linkTypeFunction = () => string; + interface Option { allowEmpty?: boolean; basePath: string; @@ -14,7 +16,7 @@ interface Option { reference: string; resource: string; source: string; - linkType: string | boolean; + linkType: string | boolean | linkTypeFunction; } export interface UseReferenceProps { @@ -50,7 +52,8 @@ export interface UseReferenceProps { * @param {Object} option * @param {boolean} option.allowEmpty do we allow for no referenced record (default to false) * @param {string} option.basePath basepath to current resource - * @param {string | false} option.linkType The type of the link toward the referenced record. edit, show of false for no link (default to edit) + * @param {string | false | linkTypeFunction} option.linkType The type of the link toward the referenced record. 'edit', 'show' or + * false for no link (default to edit). Alternatively a function that returns a string * @param {Object} option.record The The current resource record * @param {string} option.reference The linked resource name * @param {string} option.resource The current resource name @@ -80,6 +83,8 @@ export const useReference = ({ const rootPath = basePath.replace(resource, reference); const resourceLinkPath = !linkType ? false + : typeof linkType === 'function' + ? linkType() : linkToRecord(rootPath, sourceId, linkType as string); return { diff --git a/packages/ra-ui-materialui/src/field/ReferenceField.js b/packages/ra-ui-materialui/src/field/ReferenceField.js index 895b469940b..27e004e2f8d 100644 --- a/packages/ra-ui-materialui/src/field/ReferenceField.js +++ b/packages/ra-ui-materialui/src/field/ReferenceField.js @@ -149,7 +149,7 @@ ReferenceField.propTypes = { sortBy: PropTypes.string, source: PropTypes.string.isRequired, translateChoice: PropTypes.func, - linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]) + linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]) .isRequired, }; From 251303512ccab2404e95817db470bb0b1bafc663 Mon Sep 17 00:00:00 2001 From: fargito Date: Tue, 28 May 2019 10:54:50 +0200 Subject: [PATCH 2/6] update docs --- docs/Fields.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/Fields.md b/docs/Fields.md index ceb00031900..f42b1c81862 100644 --- a/docs/Fields.md +++ b/docs/Fields.md @@ -520,6 +520,15 @@ You can also prevent `` from adding link to children by setting ``` +You can also use a custom `linkType` function to get a custom path for the children. + +```jsx +// Custom path + '/my/path'}> + + +``` + **Tip**: React-admin uses `CRUD_GET_ONE_REFERENCE` action to accumulate and deduplicate the ids of the referenced records to make *one* `GET_MANY` call for the entire list, instead of n `GET_ONE` calls. So for instance, if the API returns the following list of comments: ```jsx From aafcd49200222fbc4c39ac5d752988ffb5af29ce Mon Sep 17 00:00:00 2001 From: fargito Date: Tue, 4 Jun 2019 17:51:18 +0200 Subject: [PATCH 3/6] add record and reference as arguments for linkType --- docs/Fields.md | 4 ++-- packages/ra-core/src/controller/field/useReference.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/Fields.md b/docs/Fields.md index f42b1c81862..e033f7f6a2a 100644 --- a/docs/Fields.md +++ b/docs/Fields.md @@ -520,11 +520,11 @@ You can also prevent `` from adding link to children by setting ``` -You can also use a custom `linkType` function to get a custom path for the children. +You can also use a custom `linkType` function to get a custom path for the children. This function must accept sourceId and reference as arguments. ```jsx // Custom path - '/my/path'}> + `/my/path/to/${reference}/${sourceId}`}> ``` diff --git a/packages/ra-core/src/controller/field/useReference.ts b/packages/ra-core/src/controller/field/useReference.ts index 08a245331c9..1f62c4981e1 100644 --- a/packages/ra-core/src/controller/field/useReference.ts +++ b/packages/ra-core/src/controller/field/useReference.ts @@ -7,7 +7,7 @@ import { crudGetManyAccumulate } from '../../actions'; import { linkToRecord } from '../../util'; import { Record, ReduxState } from '../../types'; -type linkTypeFunction = () => string; +type linkTypeFunction = (record: Record, reference: string) => string; interface Option { allowEmpty?: boolean; @@ -52,8 +52,7 @@ export interface UseReferenceProps { * @param {Object} option * @param {boolean} option.allowEmpty do we allow for no referenced record (default to false) * @param {string} option.basePath basepath to current resource - * @param {string | false | linkTypeFunction} option.linkType The type of the link toward the referenced record. 'edit', 'show' or - * false for no link (default to edit). Alternatively a function that returns a string + * @param {string | false | linkTypeFunction} option.linkType The type of the link toward the referenced record. 'edit', 'show' or false for no link (default to edit). Alternatively a function that returns a string * @param {Object} option.record The The current resource record * @param {string} option.reference The linked resource name * @param {string} option.resource The current resource name @@ -84,7 +83,7 @@ export const useReference = ({ const resourceLinkPath = !linkType ? false : typeof linkType === 'function' - ? linkType() + ? linkType(record, reference) : linkToRecord(rootPath, sourceId, linkType as string); return { From 3c7f7e2211ab9bac43c992764b3ff2fb771a1956 Mon Sep 17 00:00:00 2001 From: fargito Date: Wed, 5 Jun 2019 10:45:49 +0200 Subject: [PATCH 4/6] replace linkType with linkTo, keep backward-compatibility, update docs --- docs/Fields.md | 12 +++---- .../src/controller/field/useReference.ts | 35 +++++++++++++------ .../src/field/ReferenceField.js | 30 ++++++++++++---- .../src/field/sanitizeRestProps.ts | 1 + 4 files changed, 55 insertions(+), 23 deletions(-) diff --git a/docs/Fields.md b/docs/Fields.md index e033f7f6a2a..f229663f2f2 100644 --- a/docs/Fields.md +++ b/docs/Fields.md @@ -495,10 +495,10 @@ With this configuration, `` wraps the user's name in a link to t ``` -To change the link from the `` page to the `` page, set the `linkType` prop to "show". +To change the link from the `` page to the `` page, set the `linkTo` prop to "show". ```jsx - + ``` @@ -511,20 +511,20 @@ By default, `` is sorted by its `source`. To specify another att ``` -You can also prevent `` from adding link to children by setting `linkType` to `false`. +You can also prevent `` from adding link to children by setting `linkTo` to `false`. ```jsx // No link - + ``` -You can also use a custom `linkType` function to get a custom path for the children. This function must accept sourceId and reference as arguments. +You can also use a custom `linkTo` function to get a custom path for the children. This function must accept `record` and `reference` as arguments. On previous versions of React-Admin, this prop was named `LinkType`, however you should migrate it to `linkTo`. ```jsx // Custom path - `/my/path/to/${reference}/${sourceId}`}> + `/my/path/to/${reference}/${record.id}`}> ``` diff --git a/packages/ra-core/src/controller/field/useReference.ts b/packages/ra-core/src/controller/field/useReference.ts index 1f62c4981e1..9aff1384fa0 100644 --- a/packages/ra-core/src/controller/field/useReference.ts +++ b/packages/ra-core/src/controller/field/useReference.ts @@ -7,7 +7,7 @@ import { crudGetManyAccumulate } from '../../actions'; import { linkToRecord } from '../../util'; import { Record, ReduxState } from '../../types'; -type linkTypeFunction = (record: Record, reference: string) => string; +type LinkToFunctionType = (record: Record, reference: string) => string; interface Option { allowEmpty?: boolean; @@ -16,7 +16,8 @@ interface Option { reference: string; resource: string; source: string; - linkType: string | boolean | linkTypeFunction; + linkTo: string | boolean | LinkToFunctionType; + linkType?: string | boolean | LinkToFunctionType; } export interface UseReferenceProps { @@ -30,7 +31,7 @@ export interface UseReferenceProps { * @type {Object} * @property {boolean} isLoading: boolean indicating if the reference has loaded * @property {Object} referenceRecord: the referenced record. - * @property {string | false} resourceLinkPath link to the page of the related record (depends on linkType) (false is no link) + * @property {string | false} resourceLinkPath link to the page of the related record (depends on linkTo) (false is no link) */ /** @@ -52,7 +53,8 @@ export interface UseReferenceProps { * @param {Object} option * @param {boolean} option.allowEmpty do we allow for no referenced record (default to false) * @param {string} option.basePath basepath to current resource - * @param {string | false | linkTypeFunction} option.linkType The type of the link toward the referenced record. 'edit', 'show' or false for no link (default to edit). Alternatively a function that returns a string + * @param {string | false | LinkToFunctionType} option.linkTo="edit" The link toward the referenced record. 'edit', 'show' or false for no link (default to edit). Alternatively a function that returns a string + * @param {string | false | LinkToFunctionType} [option.linkType] DEPRECATED : old name for linkTo * @param {Object} option.record The The current resource record * @param {string} option.reference The linked resource name * @param {string} option.resource The current resource name @@ -63,7 +65,8 @@ export interface UseReferenceProps { export const useReference = ({ allowEmpty = false, basePath, - linkType = 'edit', + linkTo = 'edit', + linkType, record = { id: '' }, reference, resource, @@ -80,11 +83,23 @@ export const useReference = ({ } }, [sourceId, reference]); const rootPath = basePath.replace(resource, reference); - const resourceLinkPath = !linkType - ? false - : typeof linkType === 'function' - ? linkType(record, reference) - : linkToRecord(rootPath, sourceId, linkType as string); + // backcompatibility : keep linkType but with warning + const getResourceLinkPath = (linkTo, linkType) => { + if (linkType !== undefined) { + console.warn("DEPRECATED : argument 'linkType' should be replaced by 'linkTo' in ") + if (!linkType) return false; + return typeof linkType === 'function' + ? linkType(record, reference) + : linkToRecord(rootPath, sourceId, linkType as string); + } + else if (linkTo) { + return typeof linkTo === 'function' + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo as string); + } + else return false; + } + const resourceLinkPath = getResourceLinkPath(linkTo, linkType) return { isLoading: !referenceRecord && !allowEmpty, diff --git a/packages/ra-ui-materialui/src/field/ReferenceField.js b/packages/ra-ui-materialui/src/field/ReferenceField.js index 27e004e2f8d..d5870e328d0 100644 --- a/packages/ra-ui-materialui/src/field/ReferenceField.js +++ b/packages/ra-ui-materialui/src/field/ReferenceField.js @@ -97,24 +97,40 @@ ReferenceFieldView.propTypes = { * * * + * @default * By default, includes a link to the page of the related record * (`/users/:userId` in the previous example). * - * Set the linkType prop to "show" to link to the page instead. + * Set the `linkTo` prop to "show" to link to the page instead. * * @example - * + * * * * + * @default * You can also prevent `` from adding link to children by setting - * `linkType` to false. + * `linkTo` to false. * * @example - * + * * * + * + * @default + * Alternatively, you can also pass a custom function to `LinkTo`. It must take reference and record + * as arguments and return a string + * + * @example + * "/path/to/${reference}/${record}"}> + * + * + * + * @default + * In previous versions of React-Admin, the prop `linkType` was used. It is now deprecated and replaced with `linkTo`. However + * backward-compatibility is still kept */ + const ReferenceField = ({ children, ...props }) => { if (React.Children.count(children) !== 1) { throw new Error(' only accepts a single child'); @@ -149,14 +165,14 @@ ReferenceField.propTypes = { sortBy: PropTypes.string, source: PropTypes.string.isRequired, translateChoice: PropTypes.func, - linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]) - .isRequired, + linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]), + linkTo: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]).isRequired, }; ReferenceField.defaultProps = { allowEmpty: false, classes: {}, - linkType: 'edit', + linkTo: 'edit', record: {}, }; diff --git a/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts b/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts index 8eee2387f42..f5a46435f5b 100644 --- a/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts +++ b/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts @@ -11,6 +11,7 @@ export default (props: object): object => 'headerClassName', 'label', 'linkType', + 'linkTo', 'locale', 'record', 'resource', From 460381fc4797e9e8d2324452e7a1f934cdb0899f Mon Sep 17 00:00:00 2001 From: fargito Date: Wed, 5 Jun 2019 11:59:43 +0200 Subject: [PATCH 5/6] rename linkTo to link, update docs and upgrade doc --- UPGRADE.md | 10 ++++ docs/Fields.md | 12 ++--- .../field/ReferenceFieldController.tsx | 12 ++--- .../src/controller/field/useReference.ts | 48 ++++++++++--------- .../src/field/ReferenceField.js | 18 +++---- .../src/field/sanitizeRestProps.ts | 2 +- 6 files changed, 57 insertions(+), 45 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index a384d2721b9..d22d3f66fc8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -78,6 +78,16 @@ If you're using a Custom App, you had to render Resource components with the reg + ``` +## ReferenceField prop `linkType` renamed to `link` + +When using the ReferenceField component, you should rename your `linkType` props to `link`. This prop now also accepts custom functions to return a link, see the Fields documentation. + +```diff +- ++ +``` + + ## `withDataProvider` no longer injects `dispatch` The `withDataProvider` HOC used to inject two props: `dataProvider`, and redux' `dispatch`. This last prop is now easy to get via the `useDispatch` hook from Redux, so `withDataProvider` no longer injects it. diff --git a/docs/Fields.md b/docs/Fields.md index f229663f2f2..c92aa1a5a23 100644 --- a/docs/Fields.md +++ b/docs/Fields.md @@ -495,10 +495,10 @@ With this configuration, `` wraps the user's name in a link to t ``` -To change the link from the `` page to the `` page, set the `linkTo` prop to "show". +To change the link from the `` page to the `` page, set the `link` prop to "show". ```jsx - + ``` @@ -511,20 +511,20 @@ By default, `` is sorted by its `source`. To specify another att ``` -You can also prevent `` from adding link to children by setting `linkTo` to `false`. +You can also prevent `` from adding link to children by setting `link` to `false`. ```jsx // No link - + ``` -You can also use a custom `linkTo` function to get a custom path for the children. This function must accept `record` and `reference` as arguments. On previous versions of React-Admin, this prop was named `LinkType`, however you should migrate it to `linkTo`. +You can also use a custom `link` function to get a custom path for the children. This function must accept `record` and `reference` as arguments. ```jsx // Custom path - `/my/path/to/${reference}/${record.id}`}> + `/my/path/to/${reference}/${record.id}`}> ``` diff --git a/packages/ra-core/src/controller/field/ReferenceFieldController.tsx b/packages/ra-core/src/controller/field/ReferenceFieldController.tsx index be27eeb55b9..e8c7d7fb5c6 100644 --- a/packages/ra-core/src/controller/field/ReferenceFieldController.tsx +++ b/packages/ra-core/src/controller/field/ReferenceFieldController.tsx @@ -1,6 +1,6 @@ import { FunctionComponent, ReactNode, ReactElement } from 'react'; import { Record } from '../../types'; -import useReference, { UseReferenceProps } from './useReference'; +import useReference, { UseReferenceProps, LinkToFunctionType } from './useReference'; interface Props { @@ -11,7 +11,7 @@ interface Props { reference: string; resource: string; source: string; - linkType: string | boolean; + link: string | boolean | LinkToFunctionType; } /** @@ -28,18 +28,18 @@ interface Props { * By default, includes a link to the page of the related record * (`/users/:userId` in the previous example). * - * Set the linkType prop to "show" to link to the page instead. + * Set the link prop to "show" to link to the page instead. * * @example - * + * * * * * You can also prevent `` from adding link to children by setting - * `linkType` to false. + * `link` to false. * * @example - * + * * * */ diff --git a/packages/ra-core/src/controller/field/useReference.ts b/packages/ra-core/src/controller/field/useReference.ts index 9aff1384fa0..c57edad72cf 100644 --- a/packages/ra-core/src/controller/field/useReference.ts +++ b/packages/ra-core/src/controller/field/useReference.ts @@ -7,7 +7,9 @@ import { crudGetManyAccumulate } from '../../actions'; import { linkToRecord } from '../../util'; import { Record, ReduxState } from '../../types'; -type LinkToFunctionType = (record: Record, reference: string) => string; +export type LinkToFunctionType = (record: Record, reference: string) => string; + +type LinkToType = string | boolean | LinkToFunctionType; interface Option { allowEmpty?: boolean; @@ -16,8 +18,8 @@ interface Option { reference: string; resource: string; source: string; - linkTo: string | boolean | LinkToFunctionType; - linkType?: string | boolean | LinkToFunctionType; + link: LinkToType; + linkType?: LinkToType; // deprecated, use link instead } export interface UseReferenceProps { @@ -31,7 +33,7 @@ export interface UseReferenceProps { * @type {Object} * @property {boolean} isLoading: boolean indicating if the reference has loaded * @property {Object} referenceRecord: the referenced record. - * @property {string | false} resourceLinkPath link to the page of the related record (depends on linkTo) (false is no link) + * @property {string | false} resourceLinkPath link to the page of the related record (depends on link) (false is no link) */ /** @@ -53,8 +55,8 @@ export interface UseReferenceProps { * @param {Object} option * @param {boolean} option.allowEmpty do we allow for no referenced record (default to false) * @param {string} option.basePath basepath to current resource - * @param {string | false | LinkToFunctionType} option.linkTo="edit" The link toward the referenced record. 'edit', 'show' or false for no link (default to edit). Alternatively a function that returns a string - * @param {string | false | LinkToFunctionType} [option.linkType] DEPRECATED : old name for linkTo + * @param {string | false | LinkToFunctionType} option.link="edit" The link toward the referenced record. 'edit', 'show' or false for no link (default to edit). Alternatively a function that returns a string + * @param {string | false | LinkToFunctionType} [option.linkType] DEPRECATED : old name for link * @param {Object} option.record The The current resource record * @param {string} option.reference The linked resource name * @param {string} option.resource The current resource name @@ -65,7 +67,7 @@ export interface UseReferenceProps { export const useReference = ({ allowEmpty = false, basePath, - linkTo = 'edit', + link = 'edit', linkType, record = { id: '' }, reference, @@ -83,23 +85,23 @@ export const useReference = ({ } }, [sourceId, reference]); const rootPath = basePath.replace(resource, reference); - // backcompatibility : keep linkType but with warning - const getResourceLinkPath = (linkTo, linkType) => { - if (linkType !== undefined) { - console.warn("DEPRECATED : argument 'linkType' should be replaced by 'linkTo' in ") - if (!linkType) return false; - return typeof linkType === 'function' - ? linkType(record, reference) - : linkToRecord(rootPath, sourceId, linkType as string); - } - else if (linkTo) { - return typeof linkTo === 'function' - ? linkTo(record, reference) - : linkToRecord(rootPath, sourceId, linkTo as string); - } - else return false; + // Backward compatibility: keep linkType but with warning + const getResourceLinkPath = (linkTo: LinkToType) => + !linkTo + ? false + : typeof linkTo === 'function' + ? linkTo(record, reference) + : linkToRecord(rootPath, sourceId, linkTo as string); + + if (linkType !== undefined) { + console.warn( + "The 'linkType' prop is deprecated and should be named to 'link' in " + ); } - const resourceLinkPath = getResourceLinkPath(linkTo, linkType) + + const resourceLinkPath = getResourceLinkPath( + linkType !== undefined ? linkType : link + ); return { isLoading: !referenceRecord && !allowEmpty, diff --git a/packages/ra-ui-materialui/src/field/ReferenceField.js b/packages/ra-ui-materialui/src/field/ReferenceField.js index d5870e328d0..9a41925712a 100644 --- a/packages/ra-ui-materialui/src/field/ReferenceField.js +++ b/packages/ra-ui-materialui/src/field/ReferenceField.js @@ -101,33 +101,33 @@ ReferenceFieldView.propTypes = { * By default, includes a link to the page of the related record * (`/users/:userId` in the previous example). * - * Set the `linkTo` prop to "show" to link to the page instead. + * Set the `link` prop to "show" to link to the page instead. * * @example - * + * * * * * @default * You can also prevent `` from adding link to children by setting - * `linkTo` to false. + * `link` to false. * * @example - * + * * * * * @default - * Alternatively, you can also pass a custom function to `LinkTo`. It must take reference and record + * Alternatively, you can also pass a custom function to `link`. It must take reference and record * as arguments and return a string * * @example - * "/path/to/${reference}/${record}"}> + * "/path/to/${reference}/${record}"}> * * * * @default - * In previous versions of React-Admin, the prop `linkType` was used. It is now deprecated and replaced with `linkTo`. However + * In previous versions of React-Admin, the prop `linkType` was used. It is now deprecated and replaced with `link`. However * backward-compatibility is still kept */ @@ -166,13 +166,13 @@ ReferenceField.propTypes = { source: PropTypes.string.isRequired, translateChoice: PropTypes.func, linkType: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]), - linkTo: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]).isRequired, + link: PropTypes.oneOfType([PropTypes.string, PropTypes.bool, PropTypes.func]).isRequired, }; ReferenceField.defaultProps = { allowEmpty: false, classes: {}, - linkTo: 'edit', + link: 'edit', record: {}, }; diff --git a/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts b/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts index f5a46435f5b..176bae545b2 100644 --- a/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts +++ b/packages/ra-ui-materialui/src/field/sanitizeRestProps.ts @@ -11,7 +11,7 @@ export default (props: object): object => 'headerClassName', 'label', 'linkType', - 'linkTo', + 'link', 'locale', 'record', 'resource', From 9efef8fb0be02c11a1fa85150a807451abe3f7d3 Mon Sep 17 00:00:00 2001 From: fargito Date: Wed, 5 Jun 2019 12:14:42 +0200 Subject: [PATCH 6/6] update tests for ReferenceFieldController --- .../field/ReferenceFieldController.spec.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/ra-core/src/controller/field/ReferenceFieldController.spec.tsx b/packages/ra-core/src/controller/field/ReferenceFieldController.spec.tsx index 7a3acc8caad..874b8d75df3 100644 --- a/packages/ra-core/src/controller/field/ReferenceFieldController.spec.tsx +++ b/packages/ra-core/src/controller/field/ReferenceFieldController.spec.tsx @@ -156,7 +156,7 @@ describe('', () => { }); }); - it('should render a link to the Show page of the related record when the linkType is show', () => { + it('should render a link to the Show page of the related record when the link is show', () => { const children = jest.fn().mockReturnValue(children); renderWithRedux( ', () => { resource="comments" reference="posts" basePath="/comments" - linkType="show" + link="show" > {children} , @@ -179,7 +179,7 @@ describe('', () => { }); }); - it('should accept edit as resource name when linkType is show', () => { + it('should accept edit as resource name when link is show', () => { const children = jest.fn().mockReturnValue(children); renderWithRedux( ', () => { reference="edit" resource="show" basePath="/show" - linkType="show" + link="show" > {children} , @@ -210,7 +210,7 @@ describe('', () => { }); }); - it('should accept show as resource name when linkType is show', () => { + it('should accept show as resource name when link is show', () => { const children = jest.fn().mockReturnValue(children); renderWithRedux( ', () => { resource="edit" basePath="/edit" crudGetManyAccumulate={crudGetManyAccumulate} - linkType="show" + link="show" > {children} , @@ -242,7 +242,7 @@ describe('', () => { }); }); - it('should set resourceLinkPath to false when the linkType is false', () => { + it('should set resourceLinkPath to false when the link is false', () => { const children = jest.fn().mockReturnValue(children); renderWithRedux( ', () => { source="postId" reference="posts" basePath="/foo" - linkType={false} + link={false} > {children} ,