-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a fallback default record chip generator (#5860)
The record chip generator context was missing a edge were a new field of type relation is created and not yet in the metadata so no chip generator function can be precomputed. For now I added a fallback default chip generator, to prevent any bug, but we might want to add a new chip generator function while creating the new field ?
- Loading branch information
1 parent
582653f
commit 65fc83a
Showing
3 changed files
with
19 additions
and
2 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/twenty-front/src/modules/object-metadata/utils/generateDefaultRecordChipData.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { isFieldFullNameValue } from '@/object-record/record-field/types/guards/isFieldFullNameValue'; | ||
import { ObjectRecord } from '@/object-record/types/ObjectRecord'; | ||
|
||
export const generateDefaultRecordChipData = (record: ObjectRecord) => { | ||
const name = isFieldFullNameValue(record.name) | ||
? record.name.firstName + ' ' + record.name.lastName | ||
: record.name ?? ''; | ||
|
||
return { | ||
name, | ||
avatarUrl: name, | ||
avatarType: 'rounded', | ||
linkToShowPage: false, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters