fix: Use namePlural instead of labelPlural for favorite view URLs (#11407)

closes #11404

Used `namePlural` instead of `labelPlural` for generating favorite view
URLs to ensure proper routing across all languages.
This commit is contained in:
nitin
2025-04-07 12:24:43 +05:30
committed by GitHub
parent f365caa365
commit a627eff5c2
2 changed files with 8 additions and 8 deletions

View File

@ -3,11 +3,11 @@ import { View } from '@/views/types/View';
import { isDefined } from 'twenty-shared/utils';
type ReturnType = {
labelPlural: string;
namePlural: string;
view: Pick<View, 'id' | 'name' | 'objectMetadataId'>;
};
export const getObjectMetadataLabelPluralFromViewId = (
export const getObjectMetadataNamePluralFromViewId = (
view: Pick<View, 'id' | 'name' | 'objectMetadataId'>,
objectMetadataItems: ObjectMetadataItem[],
): ReturnType => {
@ -21,10 +21,10 @@ export const getObjectMetadataLabelPluralFromViewId = (
);
}
const { labelPlural } = objectMetadataItem;
const { namePlural } = objectMetadataItem;
return {
labelPlural,
namePlural,
view,
};
};

View File

@ -1,13 +1,13 @@
import { Favorite } from '@/favorites/types/Favorite';
import { getObjectMetadataNamePluralFromViewId } from '@/favorites/utils/getObjectMetadataNamePluralFromViewId';
import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { ObjectMetadataItem } from '@/object-metadata/types/ObjectMetadataItem';
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
import { ObjectRecordIdentifier } from '@/object-record/types/ObjectRecordIdentifier';
import { AppPath } from '@/types/AppPath';
import { View } from '@/views/types/View';
import { getAppPath } from '~/utils/navigation/getAppPath';
import { getObjectMetadataLabelPluralFromViewId } from './getObjectMetadataLabelPluralFromViewId';
import { isDefined } from 'twenty-shared/utils';
import { getAppPath } from '~/utils/navigation/getAppPath';
export type ProcessedFavorite = Favorite & {
Icon?: string;
@ -39,7 +39,7 @@ export const sortFavorites = (
} as ProcessedFavorite;
}
const { labelPlural } = getObjectMetadataLabelPluralFromViewId(
const { namePlural } = getObjectMetadataNamePluralFromViewId(
view,
objectMetadataItems,
);
@ -54,7 +54,7 @@ export const sortFavorites = (
labelIdentifier: view?.name,
link: getAppPath(
AppPath.RecordIndexPage,
{ objectNamePlural: labelPlural.toLowerCase() },
{ objectNamePlural: namePlural },
favorite.viewId ? { viewId: favorite.viewId } : undefined,
),
forWorkspaceMemberId: favorite.forWorkspaceMemberId,