In this PR I'm optimizing a whole RecordTableCell in real conditions with a complex RelationFieldDisplay component : - Broke down getObjectRecordIdentifier into multiple utils - Precompute memoized function for getting chip data per field with useRecordChipDataGenerator() - Refactored RelationFieldDisplay - Use CSS modules where performance is needed instead of styled components - Create a CSS theme with global CSS variables to be used by CSS modules
23 lines
694 B
TypeScript
23 lines
694 B
TypeScript
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
|
import { getBasePathToShowPage } from '@/object-metadata/utils/getBasePathToShowPage';
|
|
import { ObjectRecord } from '@/object-record/types/ObjectRecord';
|
|
|
|
export const getLinkToShowPage = (
|
|
objectNameSingular: string,
|
|
record: ObjectRecord,
|
|
) => {
|
|
const basePathToShowPage = getBasePathToShowPage({
|
|
objectNameSingular,
|
|
});
|
|
|
|
const isWorkspaceMemberObjectMetadata =
|
|
objectNameSingular === CoreObjectNameSingular.WorkspaceMember;
|
|
|
|
const linkToShowPage =
|
|
isWorkspaceMemberObjectMetadata || !record.id
|
|
? ''
|
|
: `${basePathToShowPage}${record.id}`;
|
|
|
|
return linkToShowPage;
|
|
};
|