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` const peopleSelectorFragment = graphql`
fragment PeopleSelector_organization on Organization { fragment PeopleSelector_organization on Organization {
id id
peoples(first: 100) { peoples(first: 100)
@connection(key: "PeopleSelector_organization_peoples") {
edges { edges {
node { node {
id id

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<0229a3e8e814cf3971479aa5abc20322>> * @generated SignedSource<<8bfccae4e1629a74d3651300b7f45768>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -39,12 +39,26 @@ v1 = [
} }
], ],
v2 = { v2 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
v3 = {
"alias": null, "alias": null,
"args": null, "args": null,
"kind": "ScalarField", "kind": "ScalarField",
"name": "id", "name": "id",
"storageKey": null "storageKey": null
}; },
v4 = [
{
"kind": "Literal",
"name": "first",
"value": 100
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": (v0/*: any*/),
@@ -86,26 +100,14 @@ return {
"name": "node", "name": "node",
"plural": false, "plural": false,
"selections": [ "selections": [
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "__typename",
"storageKey": null
},
(v2/*: any*/), (v2/*: any*/),
(v3/*: any*/),
{ {
"kind": "InlineFragment", "kind": "InlineFragment",
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": [ "args": (v4/*: any*/),
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"concreteType": "PeopleConnection", "concreteType": "PeopleConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "peoples", "name": "peoples",
@@ -127,7 +129,7 @@ return {
"name": "node", "name": "node",
"plural": false, "plural": false,
"selections": [ "selections": [
(v2/*: any*/), (v3/*: any*/),
{ {
"alias": null, "alias": null,
"args": null, "args": null,
@@ -141,15 +143,57 @@ return {
"kind": "ScalarField", "kind": "ScalarField",
"name": "primaryEmailAddress", "name": "primaryEmailAddress",
"storageKey": null "storageKey": null
},
(v2/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
} }
], ],
"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": null
} }
], ],
"storageKey": "peoples(first:100)" "storageKey": "peoples(first:100)"
},
{
"alias": null,
"args": (v4/*: any*/),
"filters": null,
"handle": "connection",
"key": "PeopleSelector_organization_peoples",
"kind": "LinkedHandle",
"name": "peoples"
} }
], ],
"type": "Organization", "type": "Organization",
@@ -161,12 +205,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "edb18dbe0439fa7ca7bc791e607cd447", "cacheID": "cb5621c91f5548cd81c31d40b51ac894",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "CreatePolicyPageQuery", "name": "CreatePolicyPageQuery",
"operationKind": "query", "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 * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -137,7 +137,14 @@ v7 = {
"kind": "ScalarField", "kind": "ScalarField",
"name": "__typename", "name": "__typename",
"storageKey": null "storageKey": null
}; },
v8 = [
{
"kind": "Literal",
"name": "first",
"value": 100
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": [ "argumentDefinitions": [
@@ -219,13 +226,7 @@ return {
"selections": [ "selections": [
{ {
"alias": null, "alias": null,
"args": [ "args": (v8/*: any*/),
{
"kind": "Literal",
"name": "first",
"value": 100
}
],
"concreteType": "PeopleConnection", "concreteType": "PeopleConnection",
"kind": "LinkedField", "kind": "LinkedField",
"name": "peoples", "name": "peoples",
@@ -255,15 +256,57 @@ return {
"kind": "ScalarField", "kind": "ScalarField",
"name": "primaryEmailAddress", "name": "primaryEmailAddress",
"storageKey": null "storageKey": null
},
(v7/*: any*/)
],
"storageKey": null
},
{
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "cursor",
"storageKey": null
} }
], ],
"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": null
} }
], ],
"storageKey": "peoples(first:100)" "storageKey": "peoples(first:100)"
},
{
"alias": null,
"args": (v8/*: any*/),
"filters": null,
"handle": "connection",
"key": "PeopleSelector_organization_peoples",
"kind": "LinkedHandle",
"name": "peoples"
} }
], ],
"type": "Organization", "type": "Organization",
@@ -275,12 +318,12 @@ return {
] ]
}, },
"params": { "params": {
"cacheID": "abbd1265e5fbacc34d5442772cbd645b", "cacheID": "48cf7497849c327c91bff96c755645eb",
"id": null, "id": null,
"metadata": {}, "metadata": {},
"name": "UpdatePolicyPageQuery", "name": "UpdatePolicyPageQuery",
"operationKind": "query", "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"
} }
}; };
})(); })();