Fix UI does not refresh after importing a framework

close #39

Signed-off-by: gearnode <bryan@frimin.fr>
This commit is contained in:
gearnode
2025-03-19 13:19:47 +01:00
parent 7efae81113
commit caab4b0896
2 changed files with 171 additions and 123 deletions

View File

@@ -5,6 +5,7 @@ import {
usePreloadedQuery, usePreloadedQuery,
useQueryLoader, useQueryLoader,
useMutation, useMutation,
ConnectionHandler,
} from "react-relay"; } from "react-relay";
import { Card, CardContent } from "@/components/ui/card"; import { Card, CardContent } from "@/components/ui/card";
import { Link, useParams } from "react-router"; import { Link, useParams } from "react-router";
@@ -57,9 +58,10 @@ const FrameworkListPageQuery = graphql`
const FrameworkListPageImportFrameworkMutation = graphql` const FrameworkListPageImportFrameworkMutation = graphql`
mutation FrameworkListPageImportFrameworkMutation( mutation FrameworkListPageImportFrameworkMutation(
$input: ImportFrameworkInput! $input: ImportFrameworkInput!
$connections: [ID!]!
) { ) {
importFramework(input: $input) { importFramework(input: $input) {
frameworkEdge { frameworkEdge @prependEdge(connections: $connections) {
node { node {
id id
name name
@@ -151,6 +153,12 @@ function FrameworkListPageContent({
importFramework({ importFramework({
variables: { variables: {
connections: [
ConnectionHandler.getConnectionID(
organizationId!,
"FrameworkListPage_frameworks"
),
],
input: { input: {
organizationId: organizationId!, organizationId: organizationId!,
file: null, file: null,

View File

@@ -1,5 +1,5 @@
/** /**
* @generated SignedSource<<92f143ac22d00fc2373928c607a105fa>> * @generated SignedSource<<f8b972f4147ecb52da49f44ef9c62df1>>
* @lightSyntaxTransform * @lightSyntaxTransform
* @nogrep * @nogrep
*/ */
@@ -15,6 +15,7 @@ export type ImportFrameworkInput = {
organizationId: string; organizationId: string;
}; };
export type FrameworkListPageImportFrameworkMutation$variables = { export type FrameworkListPageImportFrameworkMutation$variables = {
connections: ReadonlyArray<string>;
input: ImportFrameworkInput; input: ImportFrameworkInput;
}; };
export type FrameworkListPageImportFrameworkMutation$data = { export type FrameworkListPageImportFrameworkMutation$data = {
@@ -44,36 +45,31 @@ export type FrameworkListPageImportFrameworkMutation = {
}; };
const node: ConcreteRequest = (function(){ const node: ConcreteRequest = (function(){
var v0 = [ var v0 = {
{ "defaultValue": null,
"kind": "LocalArgument",
"name": "connections"
},
v1 = {
"defaultValue": null, "defaultValue": null,
"kind": "LocalArgument", "kind": "LocalArgument",
"name": "input" "name": "input"
}
],
v1 = {
"alias": null,
"args": null,
"kind": "ScalarField",
"name": "id",
"storageKey": null
}, },
v2 = [ v2 = [
{
"alias": null,
"args": [
{ {
"kind": "Variable", "kind": "Variable",
"name": "input", "name": "input",
"variableName": "input" "variableName": "input"
} }
], ],
"concreteType": "ImportFrameworkPayload", v3 = {
"kind": "LinkedField", "alias": null,
"name": "importFramework", "args": null,
"plural": false, "kind": "ScalarField",
"selections": [ "name": "id",
{ "storageKey": null
},
v4 = {
"alias": null, "alias": null,
"args": null, "args": null,
"concreteType": "FrameworkEdge", "concreteType": "FrameworkEdge",
@@ -89,7 +85,7 @@ v2 = [
"name": "node", "name": "node",
"plural": false, "plural": false,
"selections": [ "selections": [
(v1/*: any*/), (v3/*: any*/),
{ {
"alias": null, "alias": null,
"args": null, "args": null,
@@ -134,7 +130,7 @@ v2 = [
"name": "node", "name": "node",
"plural": false, "plural": false,
"selections": [ "selections": [
(v1/*: any*/), (v3/*: any*/),
{ {
"alias": null, "alias": null,
"args": null, "args": null,
@@ -170,27 +166,71 @@ v2 = [
} }
], ],
"storageKey": null "storageKey": null
} };
],
"storageKey": null
}
];
return { return {
"fragment": { "fragment": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": [
(v0/*: any*/),
(v1/*: any*/)
],
"kind": "Fragment", "kind": "Fragment",
"metadata": null, "metadata": null,
"name": "FrameworkListPageImportFrameworkMutation", "name": "FrameworkListPageImportFrameworkMutation",
"selections": (v2/*: any*/), "selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "ImportFrameworkPayload",
"kind": "LinkedField",
"name": "importFramework",
"plural": false,
"selections": [
(v4/*: any*/)
],
"storageKey": null
}
],
"type": "Mutation", "type": "Mutation",
"abstractKey": null "abstractKey": null
}, },
"kind": "Request", "kind": "Request",
"operation": { "operation": {
"argumentDefinitions": (v0/*: any*/), "argumentDefinitions": [
(v1/*: any*/),
(v0/*: any*/)
],
"kind": "Operation", "kind": "Operation",
"name": "FrameworkListPageImportFrameworkMutation", "name": "FrameworkListPageImportFrameworkMutation",
"selections": (v2/*: any*/) "selections": [
{
"alias": null,
"args": (v2/*: any*/),
"concreteType": "ImportFrameworkPayload",
"kind": "LinkedField",
"name": "importFramework",
"plural": false,
"selections": [
(v4/*: any*/),
{
"alias": null,
"args": null,
"filters": null,
"handle": "prependEdge",
"key": "",
"kind": "LinkedHandle",
"name": "frameworkEdge",
"handleArgs": [
{
"kind": "Variable",
"name": "connections",
"variableName": "connections"
}
]
}
],
"storageKey": null
}
]
}, },
"params": { "params": {
"cacheID": "946e840d5f7bb3a33e7ee1d0e2180bb5", "cacheID": "946e840d5f7bb3a33e7ee1d0e2180bb5",
@@ -203,6 +243,6 @@ return {
}; };
})(); })();
(node as any).hash = "715a97d6fde9a26f202e8281b9211b1f"; (node as any).hash = "76c55c89cce3718241b2ee63f026197b";
export default node; export default node;