-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored and improved seeds #8695
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
This PR adds comprehensive seeding functionality and rich text field support across the application, including new demo data and field types for testing.
- Added RichTextFieldInput with BlockNote editor integration for inline rich text editing in tables
- Introduced new SeederService with support for custom objects, composite fields, and improved data seeding capabilities
- Added 10 new demo field types to Company seeds (UUID, RichText, Array, Rating, etc.) with corresponding metadata and views
- Added new seed data files for pets and survey results with 100 records each for testing
- Fixed color naming consistency from 'grey' to 'gray' across multiple theme and UI files
51 file(s) reviewed, 36 comment(s)
Edit PR Review Bot Settings | Greptile
packages/twenty-front/src/modules/object-record/record-field/components/FieldInput.tsx
Show resolved
Hide resolved
const persistField = usePersistField(); | ||
|
||
const persistRichTextField = (nextValue: PartialBlock[]) => { | ||
if (!nextValue) persistField(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Missing return after setting null - could cause undefined behavior by continuing execution
const draftValueParsed: PartialBlock[] = isNonEmptyString(draftValue) | ||
? JSON.parse(draftValue) | ||
: draftValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: JSON.parse could throw if draftValue is malformed JSON - needs try/catch
...ges/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRichTextField.ts
Show resolved
Hide resolved
fieldName, | ||
); | ||
|
||
const fieldValueParsed = parseJson<PartialBlock[]>(fieldValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: parseJson could return undefined/null - need to handle this case explicitly to avoid runtime errors when using fieldValueParsed
packages/twenty-server/src/engine/workspace-manager/workspace-manager.service.ts
Show resolved
Hide resolved
@WorkspaceIsNullable() | ||
demoRichText: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: demoRichText should be typed as FieldRichTextValue or string[] instead of string to match the RichText field type
packages/twenty-server/src/modules/company/standard-objects/company.workspace-entity.ts
Show resolved
Hide resolved
if (!isDefined(themeColor)) { | ||
console.warn(`Tag color ${color} is not defined in the theme`); | ||
return theme.tag.background.gray; | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Consider throwing an error instead of silently falling back to gray, since an undefined theme color likely indicates a bug that should be fixed
@@ -44,8 +44,7 @@ | |||
"nx", | |||
"run", | |||
"twenty-server:command", | |||
"my-command", | |||
"--my-parameter value", | |||
"workspace:seed:demo", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert
}; | ||
}; | ||
|
||
export type FieldLinkMetadata = { | ||
objectMetadataNameSingular?: string; | ||
placeHolder: string; | ||
fieldName: string; | ||
settings?: Record<string, never>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already done in another PR, let's see who merges first
@@ -8,7 +8,7 @@ export const DEMO_SEED_WORKSPACE_MEMBER_IDS = { | |||
TIM: '20202020-1553-45c6-a028-5a9064cce07e', | |||
}; | |||
|
|||
export const workspaceMemberPrefillData = async ( | |||
export const seedWorkspaceMemberWithDemoData = async ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we move it out from prefill data, aren't we breaking workspace creation?
@@ -141,6 +141,16 @@ export const COMPANY_STANDARD_FIELD_IDS = { | |||
attachments: '20202020-c1b5-4120-b0f0-987ca401ed53', | |||
timelineActivities: '20202020-0414-4daf-9c0d-64fe7b27f89f', | |||
searchVector: '85c71601-72f9-4b7b-b343-d46100b2c74d', | |||
demoUUID: '20202020-ce6a-445e-9ece-a2f6bc98fa0b', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, these are custom fields and should not have standardIds
@@ -48,6 +51,20 @@ export const SEARCH_FIELDS_FOR_COMPANY: FieldTypeAndNameMetadata[] = [ | |||
{ name: DOMAIN_NAME_FIELD_NAME, type: FieldMetadataType.LINKS }, | |||
]; | |||
|
|||
export enum CompanyDemoSelect { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should not go into the company.workspace-entity.ts
Fixes #6793