Fix infinite loading on field settings (#8938)

We were experiencing infinite loading on field settings pages (creation
of new field), due to the fact that the component was being rendered on
and on and on.
This was due to useGetCurrentUserQuery calls outside of the update
function, causing renders in cascade. We also had an issue with the
component being unmounted too often.

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Marie
2024-12-06 18:46:06 +01:00
committed by GitHub
parent b2be2fb398
commit f36555bdc0
6 changed files with 28 additions and 48 deletions

View File

@ -1,3 +1,4 @@
import { WORKSPACE_MEMBER_QUERY_FRAGMENT } from '@/workspace-member/graphql/fragments/workspaceMemberQueryFragment';
import { gql } from '@apollo/client';
export const USER_QUERY_FRAGMENT = gql`
@ -62,4 +63,6 @@ export const USER_QUERY_FRAGMENT = gql`
}
userVars
}
${WORKSPACE_MEMBER_QUERY_FRAGMENT}
`;

View File

@ -1,4 +1,5 @@
// This query cannot be put in the graphQL folder because it cannot be generated by the graphQL codegen.
import { USER_QUERY_FRAGMENT } from '@/users/graphql/fragments/userQueryFragment';
import { gql } from '@apollo/client';
export const GET_CURRENT_USER = gql`
@ -7,4 +8,6 @@ export const GET_CURRENT_USER = gql`
...UserQueryFragment
}
}
${USER_QUERY_FRAGMENT}
`;