mirror of
https://github.com/strapi/strapi.git
synced 2025-09-20 05:52:08 +00:00
CM: Stop passing defaultParams down (not needed any longer)
This commit is contained in:
parent
6e2b51c280
commit
1a46ffdcdf
@ -23,7 +23,7 @@ export const RelationInputDataManager = ({
|
||||
labelAction,
|
||||
mainField,
|
||||
name,
|
||||
queryInfos: { endpoints, defaultParams, shouldDisplayRelationLink },
|
||||
queryInfos: { endpoints, shouldDisplayRelationLink },
|
||||
placeholder,
|
||||
required,
|
||||
relationType,
|
||||
@ -39,7 +39,6 @@ export const RelationInputDataManager = ({
|
||||
enabled: get(initialData, name)?.count !== 0 && !!endpoints.relation,
|
||||
endpoint: endpoints.relation,
|
||||
pageParams: {
|
||||
...defaultParams,
|
||||
pageSize: RELATIONS_TO_DISPLAY,
|
||||
},
|
||||
},
|
||||
@ -47,7 +46,6 @@ export const RelationInputDataManager = ({
|
||||
search: {
|
||||
endpoint: endpoints.search,
|
||||
pageParams: {
|
||||
...defaultParams,
|
||||
entityId: isCreatingEntry ? undefined : componentId ?? initialData.id,
|
||||
pageSize: SEARCH_RESULTS_TO_DISPLAY,
|
||||
},
|
||||
@ -249,9 +247,6 @@ RelationInputDataManager.propTypes = {
|
||||
size: PropTypes.number.isRequired,
|
||||
targetModel: PropTypes.string.isRequired,
|
||||
queryInfos: PropTypes.shape({
|
||||
defaultParams: PropTypes.shape({
|
||||
_component: PropTypes.string,
|
||||
}),
|
||||
endpoints: PropTypes.shape({
|
||||
relation: PropTypes.string,
|
||||
search: PropTypes.string.isRequired,
|
||||
|
@ -163,7 +163,6 @@ const generateRelationQueryInfos = (contentTypeConfiguration, fieldName, models)
|
||||
const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel);
|
||||
|
||||
return {
|
||||
defaultParams: {},
|
||||
shouldDisplayRelationLink,
|
||||
};
|
||||
};
|
||||
@ -173,9 +172,6 @@ const generateRelationQueryInfosForComponents = (contentTypeConfiguration, field
|
||||
const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel);
|
||||
|
||||
return {
|
||||
defaultParams: {
|
||||
component: contentTypeConfiguration.uid,
|
||||
},
|
||||
shouldDisplayRelationLink,
|
||||
};
|
||||
};
|
||||
|
@ -531,7 +531,7 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
|
||||
},
|
||||
},
|
||||
fieldSchema: { type: 'relation', targetModel: 'category' },
|
||||
queryInfos: { defaultParams: {} },
|
||||
queryInfos: {},
|
||||
},
|
||||
{
|
||||
name: 'component',
|
||||
@ -556,7 +556,6 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
|
||||
describe('generateRelationQueryInfos', () => {
|
||||
it('should return an object with the correct keys', () => {
|
||||
expect(generateRelationQueryInfos(addressSchema, 'categories', simpleModels)).toEqual({
|
||||
defaultParams: {},
|
||||
shouldDisplayRelationLink: true,
|
||||
});
|
||||
});
|
||||
@ -567,9 +566,6 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
|
||||
expect(
|
||||
generateRelationQueryInfosForComponents(addressSchema, 'categories', simpleModels)
|
||||
).toEqual({
|
||||
defaultParams: {
|
||||
component: 'api::address.address',
|
||||
},
|
||||
shouldDisplayRelationLink: true,
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user