twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
GNU Affero General Public License v3.0
15.8k stars 1.73k forks source link

Cannot add People/Company etc from web-interface when No Data(New Setup) #6186

Closed mnbro closed 4 days ago

mnbro commented 2 months ago

Hi,

For all versions : v0.21.x of twentycrm, after a fresh Install if i delete all pre-generated records for an Object, one cannot add any data from web interface, only using REST/GraphQL API.

When the buttons '+' or '+ Add Object' are clicked nothing happens.

Is there any other info that I can offer in order this bug to be solved ?

greptile-apps[bot] commented 2 months ago

To resolve the issue where no data can be added from the web interface after a fresh install, follow these steps:

  1. Check ActivityTargetsInlineCell.tsx:

    • Ensure that the ActivityTargetsInlineCell component handles cases where activityTargetObjectRecords is empty.
    • Update the overridenIsFieldEmpty prop to handle empty states correctly.
    const { FieldContextProvider: ActivityTargetsContextProvider } = useFieldContext({
     objectNameSingular: CoreObjectNameSingular.Activity,
     objectRecordId: activity.id,
     fieldMetadataName: 'activityTargets',
     fieldPosition: 3,
     overridenIsFieldEmpty: activityTargetObjectRecords.length === 0,
    });
  2. Check EventRowDynamicComponent.tsx:

    • Ensure that the EventRowDynamicComponent handles cases where event.name is not defined or empty.
    • Add a default case to handle unknown event names.
    default:
     return <div>No events available</div>;
  3. Check TimelineActivitiesQueryEffect.tsx:

    • Ensure that the useActivities hook handles cases where no activities are returned.
    • Add a condition to handle empty activity lists.
    const activities = useActivities(targetableObject);
    if (!activities.length) {
     return <div>No activities available</div>;
    }
  4. Check EventsGroup.tsx:

    • Ensure that the EventsGroup component handles cases where the group object is empty.
    • Add a condition to render a message when no events are available.
    if (!group.events.length) {
     return <div>No events available for this group</div>;
    }

These changes should ensure that the web interface can handle cases where there is no data and allow users to add new data.

References

/packages/twenty-front/src/modules/activities/inline-cell/components/ActivityTargetsInlineCell.tsx /packages/twenty-front/src/modules/activities/timelineActivities/rows/components/EventRowDynamicComponent.tsx /packages/twenty-front/src/modules/activities/timelineActivities/rows/activity/components/EventRowActivity.tsx /packages/twenty-front/src/modules/activities/timelineActivities/rows/message/components/EventRowMessage.tsx /packages/twenty-front/src/modules/activities/timelineActivities/components/TimelineActivitiesQueryEffect.tsx /packages/twenty-front/src/modules/activities/timelineActivities/components/EventsGroup.tsx

#### About Greptile This response provides a starting point for your research, not a precise solution. Help us improve! Please leave a ๐Ÿ‘ if this is helpful and ๐Ÿ‘Ž if it is irrelevant. [Ask Greptile](https://app.greptile.com/chat/github/twentyhq/twenty/main) ยท [Edit Issue Bot Settings](https://app.greptile.com/apps/github)
FelixMalfait commented 4 days ago

Sorry closing since it's an old issue and it's probably linked to a setup issue at the time.