Skip to content

Commit

Permalink
Merge pull request #19970 from strapi/fix/issue-19532
Browse files Browse the repository at this point in the history
fix issue #19532
  • Loading branch information
alexandrebodin committed Apr 2, 2024
2 parents cf82c83 + 48671c2 commit bfe081a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ export const REVIEW_WORKFLOW_FILTERS = [
type: 'relation',
mainField: {
name: 'name',

schema: {
type: 'string',
},
type: 'string',
},
},

Expand All @@ -90,10 +87,7 @@ export const REVIEW_WORKFLOW_FILTERS = [
type: 'relation',
mainField: {
name: 'id',

schema: {
type: 'integer',
},
type: 'integer',
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,7 @@ const AttributeTag = ({ attribute, filter, onClick, operator, value }: Attribute

const { fieldSchema } = attribute;

const type =
fieldSchema.type === 'relation' ? fieldSchema?.mainField?.schema?.type : fieldSchema.type;
const type = fieldSchema.type === 'relation' ? fieldSchema?.mainField?.type : fieldSchema.type;

let formattedValue = value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,8 @@ const DefaultInputs = ({
const getFilterList = (filterSchema: FilterData['fieldSchema']): Operator[] => {
let type = filterSchema.type;

if (filterSchema.type === 'relation' && filterSchema?.mainField?.schema?.type) {
type = filterSchema.mainField.schema.type;
if (filterSchema.type === 'relation' && filterSchema?.mainField?.type) {
type = filterSchema.mainField.type;
}

switch (type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe('FilterListURLQuery', () => {
type: 'relation',
mainField: {
name: 'postal_code',
schema: { type: 'string', pluginOptions: { i18n: { localized: true } } },
type: 'string',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/helper-plugin/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface FilterData {
options?: string[];
mainField?: {
name: string;
schema?: Attribute.Any;
type?: Attribute.Any['type'];
};
};
trackedEvent?: TrackingEvent;
Expand Down

0 comments on commit bfe081a

Please sign in to comment.