Load views on user load and read in cache (#3552)
* WIP * Poc * Use cached root query + remove proloaded views state * Fix storybook test + fix codegen * Return default schema if token is absent, unauthenticated if token is invalid * Use enum instead of bool --------- Co-authored-by: Thomas Trompette <thomast@twenty.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,9 +0,0 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_CURRENT_USER = gql`
|
||||
query GetCurrentUser {
|
||||
currentUser {
|
||||
...UserQueryFragment
|
||||
}
|
||||
}
|
||||
`;
|
||||
@ -0,0 +1,103 @@
|
||||
// This query cannot be put in the graphQL folder because it cannot be generated by the graphQL codegen.
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const GET_CURRENT_USER_AND_VIEWS = gql`
|
||||
query GetCurrentUserAndViews {
|
||||
currentUser {
|
||||
id
|
||||
firstName
|
||||
lastName
|
||||
email
|
||||
canImpersonate
|
||||
supportUserHash
|
||||
workspaceMember {
|
||||
id
|
||||
name {
|
||||
firstName
|
||||
lastName
|
||||
}
|
||||
colorScheme
|
||||
avatarUrl
|
||||
locale
|
||||
}
|
||||
defaultWorkspace {
|
||||
id
|
||||
displayName
|
||||
logo
|
||||
domainName
|
||||
inviteHash
|
||||
allowImpersonation
|
||||
subscriptionStatus
|
||||
featureFlags {
|
||||
id
|
||||
key
|
||||
value
|
||||
workspaceId
|
||||
}
|
||||
}
|
||||
}
|
||||
views {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
hasPreviousPage
|
||||
startCursor
|
||||
endCursor
|
||||
}
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
name
|
||||
objectMetadataId
|
||||
type
|
||||
deletedAt
|
||||
viewFilters {
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
fieldMetadataId
|
||||
operand
|
||||
value
|
||||
displayValue
|
||||
deletedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
viewSorts {
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
fieldMetadataId
|
||||
direction
|
||||
deletedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
viewFields {
|
||||
edges {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
createdAt
|
||||
updatedAt
|
||||
fieldMetadataId
|
||||
isVisible
|
||||
size
|
||||
position
|
||||
deletedAt
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
Reference in New Issue
Block a user