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, labelAction,
mainField, mainField,
name, name,
queryInfos: { endpoints, defaultParams, shouldDisplayRelationLink }, queryInfos: { endpoints, shouldDisplayRelationLink },
placeholder, placeholder,
required, required,
relationType, relationType,
@ -39,7 +39,6 @@ export const RelationInputDataManager = ({
enabled: get(initialData, name)?.count !== 0 && !!endpoints.relation, enabled: get(initialData, name)?.count !== 0 && !!endpoints.relation,
endpoint: endpoints.relation, endpoint: endpoints.relation,
pageParams: { pageParams: {
...defaultParams,
pageSize: RELATIONS_TO_DISPLAY, pageSize: RELATIONS_TO_DISPLAY,
}, },
}, },
@ -47,7 +46,6 @@ export const RelationInputDataManager = ({
search: { search: {
endpoint: endpoints.search, endpoint: endpoints.search,
pageParams: { pageParams: {
...defaultParams,
entityId: isCreatingEntry ? undefined : componentId ?? initialData.id, entityId: isCreatingEntry ? undefined : componentId ?? initialData.id,
pageSize: SEARCH_RESULTS_TO_DISPLAY, pageSize: SEARCH_RESULTS_TO_DISPLAY,
}, },
@ -249,9 +247,6 @@ RelationInputDataManager.propTypes = {
size: PropTypes.number.isRequired, size: PropTypes.number.isRequired,
targetModel: PropTypes.string.isRequired, targetModel: PropTypes.string.isRequired,
queryInfos: PropTypes.shape({ queryInfos: PropTypes.shape({
defaultParams: PropTypes.shape({
_component: PropTypes.string,
}),
endpoints: PropTypes.shape({ endpoints: PropTypes.shape({
relation: PropTypes.string, relation: PropTypes.string,
search: PropTypes.string.isRequired, search: PropTypes.string.isRequired,

View File

@ -163,7 +163,6 @@ const generateRelationQueryInfos = (contentTypeConfiguration, fieldName, models)
const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel); const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel);
return { return {
defaultParams: {},
shouldDisplayRelationLink, shouldDisplayRelationLink,
}; };
}; };
@ -173,9 +172,6 @@ const generateRelationQueryInfosForComponents = (contentTypeConfiguration, field
const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel); const shouldDisplayRelationLink = getDisplayedModels(models).includes(targetModel);
return { return {
defaultParams: {
component: contentTypeConfiguration.uid,
},
shouldDisplayRelationLink, shouldDisplayRelationLink,
}; };
}; };

View File

@ -531,7 +531,7 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
}, },
}, },
fieldSchema: { type: 'relation', targetModel: 'category' }, fieldSchema: { type: 'relation', targetModel: 'category' },
queryInfos: { defaultParams: {} }, queryInfos: {},
}, },
{ {
name: 'component', name: 'component',
@ -556,7 +556,6 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
describe('generateRelationQueryInfos', () => { describe('generateRelationQueryInfos', () => {
it('should return an object with the correct keys', () => { it('should return an object with the correct keys', () => {
expect(generateRelationQueryInfos(addressSchema, 'categories', simpleModels)).toEqual({ expect(generateRelationQueryInfos(addressSchema, 'categories', simpleModels)).toEqual({
defaultParams: {},
shouldDisplayRelationLink: true, shouldDisplayRelationLink: true,
}); });
}); });
@ -567,9 +566,6 @@ describe('Content Manager | hooks | useFetchContentTypeLayout | utils ', () => {
expect( expect(
generateRelationQueryInfosForComponents(addressSchema, 'categories', simpleModels) generateRelationQueryInfosForComponents(addressSchema, 'categories', simpleModels)
).toEqual({ ).toEqual({
defaultParams: {
component: 'api::address.address',
},
shouldDisplayRelationLink: true, shouldDisplayRelationLink: true,
}); });
}); });