Fix people selector stale state

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-13 07:45:01 +01:00
parent 5883c4df06
commit 1dab503bb9
5 changed files with 188 additions and 51 deletions

View File

@@ -12,7 +12,8 @@ import { PeopleSelector_organization$key } from "./__generated__/PeopleSelector_
const peopleSelectorFragment = graphql`
fragment PeopleSelector_organization on Organization {
id
peoples(first: 100) {
peoples(first: 100)
@connection(key: "PeopleSelector_organization_peoples") {
edges {
node {
id

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<40624c6362024ecac90d44c5dd174a1c>>
* @generated SignedSource<<78caa409132a5db72b83629bdcd023d5>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -39,22 +39,27 @@ var v0 = {
return {
"argumentDefinitions": [],
"kind": "Fragment",
"metadata": null,
"metadata": {
"connection": [
{
"count": null,
"cursor": null,
"direction": "forward",
"path": [
"peoples"
]
}
]
},
"name": "PeopleSelector_organization",
"selections": [
(v0/*: any*/),
{
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"alias": "peoples",
"args": null,
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
"name": "__PeopleSelector_organization_peoples_connection",
"plural": false,
"selections": [
{
@@ -87,15 +92,54 @@ return {
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "peoples(first:100)"
"storageKey": null
}
],
"type": "Organization",
@@ -103,6 +147,6 @@ return {
};
})();
(node as any).hash = "33e28b2889fa1180f6bf491e428fbafd";
(node as any).hash = "ed86f67795b049ec359cb7e5e55500a0";
export default node;

View File

@@ -87,14 +87,19 @@ function CreatePeoplePageContent() {
const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
const peopleConnectionId = ConnectionHandler.getConnectionID(
organizationId!,
"PeopleListPage_peoples"
);
createPeople({
variables: {
connections: [peopleConnectionId],
connections: [
ConnectionHandler.getConnectionID(
organizationId!,
"PeopleListPage_peoples"
),
ConnectionHandler.getConnectionID(
organizationId!,
"PeopleSelector_organization_peoples"
),
],
input: {
organizationId: organizationId!,
fullName: formData.fullName,

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<0229a3e8e814cf3971479aa5abc20322>>
* @generated SignedSource<<8bfccae4e1629a74d3651300b7f45768>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -39,12 +39,26 @@ v1 = [
}
],
v2 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v3 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
};
},
v4 = [
{
"kind": "Literal",
"name": "first",
"value": 100
}
];
return {
"fragment": {
"argumentDefinitions": (v0/*: any*/),
@@ -86,26 +100,14 @@ return {
"name": "node",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
(v2/*: any*/),
(v3/*: any*/),
{
"kind": "InlineFragment",
"selections": [
{
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"args": (v4/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -127,7 +129,7 @@ return {
"name": "node",
"plural": false,
"selections": [
(v2/*: any*/),
(v3/*: any*/),
{
"alias": null,
"args": null,
@@ -141,15 +143,57 @@ return {
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
}
},
(v2/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "peoples(first:100)"
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"handle": "connection",
"key": "PeopleSelector_organization_peoples",
"kind": "LinkedHandle",
"name": "peoples"
}
],
"type": "Organization",
@@ -161,12 +205,12 @@ return {
]
},
"params": {
"cacheID": "edb18dbe0439fa7ca7bc791e607cd447",
"cacheID": "cb5621c91f5548cd81c31d40b51ac894",
"id": null,
"metadata": {},
"name": "CreatePolicyPageQuery",
"operationKind": "query",
"text": "query CreatePolicyPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
"text": "query CreatePolicyPageQuery(\n $organizationId: ID!\n) {\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();

View File

@@ -1,5 +1,5 @@
/**
* @generated SignedSource<<04e2a37d31d4cd204101efdd85471dc5>>
* @generated SignedSource<<7b013568b7e507b2394323b6cdc4d8ba>>
* @lightSyntaxTransform
* @nogrep
*/
@@ -137,7 +137,14 @@ v7 = {
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
};
},
v8 = [
{
"kind": "Literal",
"name": "first",
"value": 100
}
];
return {
"fragment": {
"argumentDefinitions": [
@@ -219,13 +226,7 @@ return {
"selections": [
{
"alias": null,
"args": [
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"args": (v8/*: any*/),
"concreteType": "PeopleConnection",
"kind": "LinkedField",
"name": "peoples",
@@ -255,15 +256,57 @@ return {
"kind": "ScalarField",
"name": "primaryEmailAddress",
"storageKey": null
}
},
(v7/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
}
],
"storageKey": null
},
{
"alias": null,
"args": null,
"concreteType": "PageInfo",
"kind": "LinkedField",
"name": "pageInfo",
"plural": false,
"selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "endCursor",
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "hasNextPage",
"storageKey": null
}
],
"storageKey": null
}
],
"storageKey": "peoples(first:100)"
},
{
"alias": null,
"args": (v8/*: any*/),
"filters": null,
"handle": "connection",
"key": "PeopleSelector_organization_peoples",
"kind": "LinkedHandle",
"name": "peoples"
}
],
"type": "Organization",
@@ -275,12 +318,12 @@ return {
]
},
"params": {
"cacheID": "abbd1265e5fbacc34d5442772cbd645b",
"cacheID": "48cf7497849c327c91bff96c755645eb",
"id": null,
"metadata": {},
"name": "UpdatePolicyPageQuery",
"operationKind": "query",
"text": "query UpdatePolicyPageQuery(\n $policyId: ID!\n $organizationId: ID!\n) {\n policy: node(id: $policyId) {\n __typename\n id\n ... on Policy {\n name\n content\n status\n version\n reviewDate\n owner {\n id\n fullName\n }\n }\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n }\n }\n }\n}\n"
"text": "query UpdatePolicyPageQuery(\n $policyId: ID!\n $organizationId: ID!\n) {\n policy: node(id: $policyId) {\n __typename\n id\n ... on Policy {\n name\n content\n status\n version\n reviewDate\n owner {\n id\n fullName\n }\n }\n }\n organization: node(id: $organizationId) {\n __typename\n ...PeopleSelector_organization\n id\n }\n}\n\nfragment PeopleSelector_organization on Organization {\n id\n peoples(first: 100) {\n edges {\n node {\n id\n fullName\n primaryEmailAddress\n __typename\n }\n cursor\n }\n pageInfo {\n endCursor\n hasNextPage\n }\n }\n}\n"
}
};
})();