CM: Stop passing defaultParams down (not needed any longer)

This commit is contained in:
Gustav Hansen 2022-11-02 15:24:44 +01:00
parent 6e2b51c280
commit 1a46ffdcdf
3 changed files with 2 additions and 15 deletions

View File

@ -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,

View File

@ -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,
};
};

View File

@ -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,
});
});