Skip to content
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

Removed edges and nodes outside of useFindManyRecords. #4623

Closed
wants to merge 11 commits into from

Conversation

lucasbordeau
Copy link
Contributor

@lucasbordeau lucasbordeau commented Mar 22, 2024

This PR removes edges and nodes from the records we manipulate outside of useFindManyRecords.

We have to keep relay-style pagination inside the cache, because it's necessary for pagination and being consistent with the backend.

We can consider everything related to cache manipulation as "internals" and keep our current logic which works well.

For everything related to features outside of our internal API, we want to have nested relations on objects as arrays instead of connections, that's where this PR comes into play.

  • It removes nested connections from records that are retrieved from useFindManyRecords.
  • Provides a way to work the other way around, e.g. putting back nested connections instead of nested arrays on a record.
  • Applied the records<=>connections utils on all the hooks that manipulates cache and CRUD.

Copy link

github-actions bot commented Mar 22, 2024

TODOs/FIXMEs:

  • // TODO: remove this and use only mapConnectionToRecords when we've finished the refactor: packages/twenty-front/src/modules/object-record/hooks/useFindManyRecords.ts
  • // TODO: fix type: packages/twenty-front/src/modules/activities/hooks/useCreateActivityInDB.ts
  • // TODO: fix type: packages/twenty-front/src/modules/activities/hooks/useDeleteActivityFromCache.ts
  • // TODO: fix connection in relation => automatically change to an array: packages/twenty-front/src/modules/activities/hooks/useActivityById.ts
  • // TODO: fix connection in relation => automatically change to an array: packages/twenty-front/src/modules/activities/hooks/useActivities.ts
  • // TODO: use new relation type: packages/twenty-front/src/modules/object-record/record-show/record-detail-section/components/RecordDetailRelationSection.tsx

Generated by 🚫 dangerJS against 657103a

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, let's keep iterating from there

@charlesBochet
Copy link
Member

As discussed with you, there are many tests to fix and there is ongoing work on another branch. Let's merge the other one with updated tests.
Closing this PR

@charlesBochet charlesBochet deleted the feat/relay-style-pagination-plugin branch June 29, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants