Open Bonapara opened 3 months ago
To improve the Relation Picker loading sequence:
Modify RelationPicker
Component:
relation-picker/RelationPicker.tsx
Add New
button is conditionally rendered based on the loading state.
{ !isLoading && <AddNewButton /> }
Update SingleEntitySelectMenuItemsWithSearch
Component:
relation-picker/SingleEntitySelectMenuItemsWithSearch.tsx
{ selectedCompany && <CompanyName>{selectedCompany.name}</CompanyName> }
{ isLoading ? <SkeletonLoader /> : <CompanyList companies={companies} /> }
Adjust useRelationPickerEntitiesOptions
Hook:
relation-picker/hooks/useRelationPickerEntitiesOptions.ts
const { selectedCompany, companies, isLoading } = useRelationPickerEntitiesOptions();
Update useRelationPicker
Hook:
relation-picker/hooks/useRelationPicker.ts
const { isLoading, selectedCompany, companies } = useRelationPicker();
Current behavior
The Relation picker is loading in three distinct steps:
Add New
Add new
button disappearsVideo:
https://github.com/twentyhq/twenty/assets/19412894/76cc6f13-d12b-4092-9795-b9ad1c986cac
Desired Behavior
We should display the "selected" company from the start when its available.
If the menu shows
All "Records"
orNo "Records"
, the skeleton loading should be above the record name. Otherwise, it should be underneath.The "Add New" button should not be displayed during loading. The loading process should have only two steps: the skeleton step and the fully loaded step.
Figma
https://www.figma.com/design/xt8O9mFeLl46C5InWwoMrN/Twenty?node-id=33541-73636&t=swXsK3PuBiFkmrTW-11