From 03189f9182a24c6e1412eb8caf271417866864ab Mon Sep 17 00:00:00 2001 From: mcharfadi Date: Wed, 7 Aug 2024 17:05:46 +0200 Subject: [PATCH] [3758] Store all form payload in a context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-web/issues/3758 Signed-off-by: Michaƫl Charfadi --- .../representations/FormRepresentation.tsx | 135 +++---------- .../FormRepresentation.types.ts | 4 +- .../FormRepresentationMachine.ts | 188 ------------------ .../representations/useFormSubscription.tsx | 92 +++++++++ .../useFormSubscription.types.ts | 48 +++++ .../src/diagrams/DiagramFilterForm.tsx | 47 ++++- .../src/diagrams/DiagramFilterForm.types.ts | 6 + .../diagrams/useDiagramFilterSubscription.tsx | 24 +-- .../useDiagramFilterSubscription.types.ts | 3 +- .../workbench-views/DetailsView.tsx | 18 +- .../workbench-views/DetailsView.types.ts | 2 + .../workbench-views/RelatedElementsView.tsx | 43 +++- .../RelatedElementsView.types.ts | 2 + .../workbench-views/RepresentationsView.tsx | 36 +++- .../RepresentationsView.types.ts | 2 + .../useDetailsViewSubscription.tsx | 25 ++- .../useDetailsViewSubscription.types.ts | 2 - .../useRelatedElementsViewSubscription.tsx | 44 ++-- ...seRelatedElementsViewSubscription.types.ts | 3 +- .../useRepresentationsViewSubscription.tsx | 47 ++--- ...seRepresentationsViewSubscription.types.ts | 4 +- 21 files changed, 370 insertions(+), 405 deletions(-) delete mode 100644 packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentationMachine.ts create mode 100644 packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.tsx create mode 100644 packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.types.ts diff --git a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.tsx b/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.tsx index bc3355635d3..63fdd07fe12 100644 --- a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.tsx @@ -10,42 +10,17 @@ * Contributors: * Obeo - initial API and implementation *******************************************************************************/ -import { gql, useSubscription } from '@apollo/client'; -import { RepresentationComponentProps, Toast } from '@eclipse-sirius/sirius-components-core'; -import Typography from '@mui/material/Typography'; -import { makeStyles } from 'tss-react/mui'; -import { useMachine } from '@xstate/react'; +import { RepresentationComponentProps } from '@eclipse-sirius/sirius-components-core'; import { useEffect, useState } from 'react'; +import { makeStyles } from 'tss-react/mui'; import { FormContext } from '../contexts/FormContext'; import { Form } from '../form/Form'; -import { formRefreshedEventPayloadFragment } from '../form/FormEventFragments'; -import { GQLFormEventSubscription } from '../form/FormEventFragments.types'; +import { GQLFormEventPayload } from '../form/FormEventFragments.types'; import { Page } from '../pages/Page'; import { ToolbarAction } from '../toolbaraction/ToolbarAction'; import { FormRepresentationState } from './FormRepresentation.types'; -import { - FormRepresentationContext, - FormRepresentationEvent, - HandleCompleteEvent, - HandleSubscriptionResultEvent, - HideToastEvent, - SchemaValue, - ShowToastEvent, - SwitchFormEvent, - formRepresentationMachine, -} from './FormRepresentationMachine'; - -const formEventSubscription = gql(` - subscription formEvent($input: FormEventInput!) { - formEvent(input: $input) { - __typename - ... on FormRefreshedEventPayload { - ...formRefreshedEventPayloadFragment - } - } - } - ${formRefreshedEventPayloadFragment} -`); +import { useFormSubscription } from './useFormSubscription'; +import { GQLFormRefreshedEventPayload } from './useFormSubscription.types'; const useFormRepresentationStyles = makeStyles()((theme) => ({ page: { @@ -76,83 +51,37 @@ const useFormRepresentationStyles = makeStyles()((theme) => ({ }, })); -/** - * Connect the Form component to the GraphQL API over Web Socket. - */ +const isFormRefreshedEventPayload = (payload: GQLFormEventPayload): payload is GQLFormRefreshedEventPayload => + payload && payload.__typename === 'FormRefreshedEventPayload'; + export const FormRepresentation = ({ editingContextId, representationId, readOnly }: RepresentationComponentProps) => { - const { classes } = useFormRepresentationStyles(); - const [{ value, context }, dispatch] = useMachine( - formRepresentationMachine, - { - context: { - formId: representationId, - }, - } - ); - const { toast, formRepresentation } = value as SchemaValue; - const { id, formId, form, message } = context; const [state, setState] = useState({ - payload: null, + form: null, }); - /** - * Displays an other form if the selection indicates that we should display another properties view. - */ + const { payload } = useFormSubscription(editingContextId, representationId); useEffect(() => { - if (formId !== representationId) { - const switchFormEvent: SwitchFormEvent = { type: 'SWITCH_FORM', formId: representationId }; - dispatch(switchFormEvent); + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, form: payload.form })); } - }, [representationId, formId, dispatch]); - - const { error } = useSubscription(formEventSubscription, { - variables: { - input: { - id, - editingContextId, - formId: representationId, - }, - }, - fetchPolicy: 'no-cache', - onData: ({ data }) => { - if (data.data) { - const { formEvent } = data.data; - setState((prevState) => ({ ...prevState, payload: formEvent })); - } - const handleDataEvent: HandleSubscriptionResultEvent = { - type: 'HANDLE_SUBSCRIPTION_RESULT', - result: data, - }; - dispatch(handleDataEvent); - }, - onComplete: () => { - const completeEvent: HandleCompleteEvent = { type: 'HANDLE_COMPLETE' }; - dispatch(completeEvent); - }, - }); + }, [payload]); - useEffect(() => { - if (error) { - const { message } = error; - const showToastEvent: ShowToastEvent = { type: 'SHOW_TOAST', message }; - dispatch(showToastEvent); - } - }, [error, dispatch]); + const { classes } = useFormRepresentationStyles(); let content: JSX.Element | null = null; - if (formRepresentation === 'ready') { - if (form.pages.length > 1) { - content =
; - } else if (form.pages.length === 1) { + if (state.form) { + if (state.form.pages.length > 1) { + content = ; + } else if (state.form.pages.length === 1) { let selectedPageToolbar = null; - if (form.pages[0].toolbarActions?.length > 0) { + if (state.form.pages[0].toolbarActions?.length > 0) { selectedPageToolbar = (
- {form.pages[0].toolbarActions.map((toolbarAction) => ( + {state.form.pages[0].toolbarActions.map((toolbarAction) => (
@@ -164,32 +93,24 @@ export const FormRepresentation = ({ editingContextId, representationId, readOnl content = (
{selectedPageToolbar} - +
); } - } else if (formRepresentation === 'complete') { - content = ( -
- - The form does not exist anymore - -
- ); } return (
{content} - dispatch({ type: 'HIDE_TOAST' } as HideToastEvent)} - />
); diff --git a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.types.ts b/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.types.ts index eba02c09dc1..48a4080ff80 100644 --- a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentation.types.ts @@ -11,8 +11,8 @@ * Obeo - initial API and implementation *******************************************************************************/ -import { GQLFormEventPayload } from '../form/FormEventFragments.types'; +import { GQLForm } from '../form/FormEventFragments.types'; export interface FormRepresentationState { - payload: GQLFormEventPayload | null; + form: GQLForm | null; } diff --git a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentationMachine.ts b/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentationMachine.ts deleted file mode 100644 index 2f81bfc687b..00000000000 --- a/packages/forms/frontend/sirius-components-forms/src/representations/FormRepresentationMachine.ts +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2021, 2024 Obeo. - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Obeo - initial API and implementation - *******************************************************************************/ -import { SubscriptionResult } from '@apollo/client'; -import { assign, Machine } from 'xstate'; -import { - GQLForm, - GQLFormEventPayload, - GQLFormEventSubscription, - GQLFormRefreshedEventPayload, -} from '../form/FormEventFragments.types'; - -export interface FormRepresentationStateSchema { - states: { - toast: { - states: { - visible: {}; - hidden: {}; - }; - }; - formRepresentation: { - states: { - idle: {}; - ready: {}; - complete: {}; - }; - }; - }; -} - -export type SchemaValue = { - toast: 'visible' | 'hidden'; - formRepresentation: 'idle' | 'ready' | 'complete'; -}; - -export interface FormRepresentationContext { - id: string; - formId: string; - form: GQLForm | null; - message: string | null; -} - -export type ShowToastEvent = { type: 'SHOW_TOAST'; message: string }; -export type HideToastEvent = { type: 'HIDE_TOAST' }; -export type SwitchFormEvent = { type: 'SWITCH_FORM'; formId: string }; -export type HandleSubscriptionResultEvent = { - type: 'HANDLE_SUBSCRIPTION_RESULT'; - result: SubscriptionResult; -}; -export type HandleCompleteEvent = { type: 'HANDLE_COMPLETE' }; -export type FormRepresentationEvent = - | SwitchFormEvent - | HandleSubscriptionResultEvent - | HandleCompleteEvent - | ShowToastEvent - | HideToastEvent; - -const isFormRefreshedEventPayload = (payload: GQLFormEventPayload): payload is GQLFormRefreshedEventPayload => - payload.__typename === 'FormRefreshedEventPayload'; - -export const formRepresentationMachine = Machine< - FormRepresentationContext, - FormRepresentationStateSchema, - FormRepresentationEvent ->( - { - type: 'parallel', - context: { - id: crypto.randomUUID(), - formId: null, - form: null, - message: null, - }, - states: { - toast: { - initial: 'hidden', - states: { - hidden: { - on: { - SHOW_TOAST: { - target: 'visible', - actions: 'setMessage', - }, - }, - }, - visible: { - on: { - HIDE_TOAST: { - target: 'hidden', - actions: 'clearMessage', - }, - }, - }, - }, - }, - formRepresentation: { - initial: 'idle', - states: { - idle: { - on: { - SWITCH_FORM: { - target: 'idle', - actions: 'switchForm', - }, - HANDLE_SUBSCRIPTION_RESULT: [ - { - cond: 'isFormRefreshedEventPayload', - target: 'ready', - actions: 'handleSubscriptionResult', - }, - { - target: 'idle', - actions: 'handleSubscriptionResult', - }, - ], - }, - }, - ready: { - on: { - SWITCH_FORM: { - target: 'idle', - actions: 'switchForm', - }, - HANDLE_SUBSCRIPTION_RESULT: { - target: 'ready', - actions: 'handleSubscriptionResult', - }, - HANDLE_COMPLETE: { - target: 'complete', - }, - }, - }, - complete: { - on: { - SWITCH_FORM: { - target: 'idle', - actions: 'switchForm', - }, - }, - }, - }, - }, - }, - }, - { - guards: { - isFormRefreshedEventPayload: (_, event) => { - const { result } = event as HandleSubscriptionResultEvent; - const { data } = result; - return isFormRefreshedEventPayload(data.formEvent); - }, - }, - actions: { - switchForm: assign((_, event) => { - const { formId } = event as SwitchFormEvent; - return { - id: crypto.randomUUID(), - formId, - }; - }), - handleSubscriptionResult: assign((_, event) => { - const { result } = event as HandleSubscriptionResultEvent; - const { data } = result; - if (isFormRefreshedEventPayload(data.formEvent)) { - const { form } = data.formEvent; - return { form }; - } - return {}; - }), - setMessage: assign((_, event) => { - const { message } = event as ShowToastEvent; - return { message }; - }), - clearMessage: assign((_) => { - return { message: null }; - }), - }, - } -); diff --git a/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.tsx b/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.tsx new file mode 100644 index 00000000000..57b59e6003c --- /dev/null +++ b/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.tsx @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ + +import { gql, OnDataOptions, useSubscription } from '@apollo/client'; +import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; +import { useEffect, useState } from 'react'; +import { formRefreshedEventPayloadFragment } from '../form/FormEventFragments'; +import { + GQLFormEventInput, + GQLFormEventPayload, + GQLFormEventSubscription, + GQLFormEventVariables, + GQLFormRefreshedEventPayload, + UseFormSubscriptionState, + UseFormSubscriptionValue, +} from './useFormSubscription.types'; + +export const formEventSubscription = ` + subscription formEvent($input: FormEventInput!) { + formEvent(input: $input) { + __typename + ... on FormRefreshedEventPayload { + ...formRefreshedEventPayloadFragment + } + } + } + ${formRefreshedEventPayloadFragment} +`; + +const isFormRefreshedEventPayload = (payload: GQLFormEventPayload): payload is GQLFormRefreshedEventPayload => + payload.__typename === 'FormRefreshedEventPayload'; + +export const useFormSubscription = (editingContextId: string, formId: string): UseFormSubscriptionValue => { + const [state, setState] = useState({ + id: crypto.randomUUID(), + complete: false, + }); + + const input: GQLFormEventInput = { + id: state.id, + editingContextId, + formId, + }; + + const variables: GQLFormEventVariables = { input }; + + const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); + + const onData = ({ data }: OnDataOptions) => { + const { data: gqlDetailsEventSubscription } = data; + if (gqlDetailsEventSubscription) { + const { formEvent: payload } = gqlDetailsEventSubscription; + setState((prevState) => ({ ...prevState, payload, complete: false })); + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, complete: false })); + } + } + }; + + const { data, error, loading } = useSubscription( + gql(formEventSubscription), + { + variables, + fetchPolicy: 'no-cache', + onData, + onComplete, + } + ); + + const { addErrorMessage } = useMultiToast(); + useEffect(() => { + if (error) { + addErrorMessage('An unexpected error has occurred, please refresh the page'); + } + }, [error]); + + return { + loading, + payload: !!data?.formEvent ? data.formEvent : null, + complete: state.complete, + }; +}; diff --git a/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.types.ts b/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.types.ts new file mode 100644 index 00000000000..476fac4da03 --- /dev/null +++ b/packages/forms/frontend/sirius-components-forms/src/representations/useFormSubscription.types.ts @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2024 Obeo. + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Obeo - initial API and implementation + *******************************************************************************/ + +import { GQLForm } from '../form/FormEventFragments.types'; + +export interface UseFormSubscriptionValue { + loading: boolean; + payload: GQLFormEventPayload | null; + complete: boolean; +} + +export interface UseFormSubscriptionState { + id: string; + complete: boolean; +} + +export interface GQLFormEventInput { + id: string; + editingContextId: string; + formId: string; +} + +export interface GQLFormEventVariables { + input: GQLFormEventInput; +} + +export interface GQLFormEventSubscription { + formEvent: GQLFormEventPayload; +} + +export interface GQLFormEventPayload { + __typename: string; +} + +export interface GQLFormRefreshedEventPayload extends GQLFormEventPayload { + __typename: 'FormRefreshedEventPayload'; + form: GQLForm; +} diff --git a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.tsx b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.tsx index 39799b7b1b1..a41901f028e 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.tsx @@ -12,10 +12,18 @@ *******************************************************************************/ import { WorkbenchViewComponentProps } from '@eclipse-sirius/sirius-components-core'; -import { FormBasedView, GQLForm, Group } from '@eclipse-sirius/sirius-components-forms'; +import { + FormBasedView, + FormContext, + GQLForm, + GQLFormRefreshedEventPayload, + Group, +} from '@eclipse-sirius/sirius-components-forms'; +import { useEffect, useState } from 'react'; import { makeStyles } from 'tss-react/mui'; -import { DiagramFilterFormProps } from './DiagramFilterForm.types'; +import { DiagramFilterFormProps, DiagramFilterViewState } from './DiagramFilterForm.types'; import { useDiagramFilterSubscription } from './useDiagramFilterSubscription'; +import { GQLDiagramFilterEventPayload } from './useDiagramFilterSubscription.types'; const useDiagramFilterViewStyles = makeStyles()((theme) => ({ idle: { @@ -26,8 +34,20 @@ const useDiagramFilterViewStyles = makeStyles()((theme) => ({ }, })); +const isFormRefreshedEventPayload = (payload: GQLDiagramFilterEventPayload): payload is GQLFormRefreshedEventPayload => + payload && payload.__typename === 'FormRefreshedEventPayload'; + export const DiagramFilterForm = ({ editingContextId, diagramId, readOnly }: DiagramFilterFormProps) => { - const { form, complete } = useDiagramFilterSubscription(editingContextId, [diagramId]); + const [state, setState] = useState({ + form: null, + }); + + const { payload, complete } = useDiagramFilterSubscription(editingContextId, [diagramId]); + useEffect(() => { + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, form: payload.form })); + } + }, [payload]); const { classes } = useDiagramFilterViewStyles(); @@ -44,15 +64,22 @@ export const DiagramFilterForm = ({ editingContextId, diagramId, readOnly }: Dia } }; - if (!form || complete) { + if (!state.form || complete) { return null; } return ( - +
+ + + +
); }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.types.ts index b22a36803dd..88a0145921b 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/DiagramFilterForm.types.ts @@ -11,8 +11,14 @@ * Obeo - initial API and implementation *******************************************************************************/ +import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; + export interface DiagramFilterFormProps { editingContextId: string; diagramId: string; readOnly: boolean; } + +export interface DiagramFilterViewState { + form: GQLForm | null; +} diff --git a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.tsx b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.tsx index 81a419fdf63..f6070813992 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.tsx @@ -13,21 +13,20 @@ import { gql, OnDataOptions, useSubscription } from '@apollo/client'; import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; -import { formRefreshedEventPayloadFragment } from '@eclipse-sirius/sirius-components-forms'; +import { + formRefreshedEventPayloadFragment, + GQLFormRefreshedEventPayload, +} from '@eclipse-sirius/sirius-components-forms'; import { useEffect, useState } from 'react'; import { GQLDiagramFilterEventInput, GQLDiagramFilterEventPayload, GQLDiagramFilterEventSubscription, GQLDiagramFilterEventVariables, - GQLFormRefreshedEventPayload, UseDiagramFilterSubscriptionState, UseDiagramFilterSubscriptionValue, } from './useDiagramFilterSubscription.types'; -const isFormRefreshedEventPayload = (payload: GQLDiagramFilterEventPayload): payload is GQLFormRefreshedEventPayload => - payload.__typename === 'FormRefreshedEventPayload'; - export const getDiagramFilterEventSubscription = ` subscription diagramFilterEvent($input: DiagramFilterEventInput!) { diagramFilterEvent(input: $input) { @@ -40,6 +39,9 @@ export const getDiagramFilterEventSubscription = ` ${formRefreshedEventPayloadFragment} `; +const isFormRefreshedEventPayload = (payload: GQLDiagramFilterEventPayload): payload is GQLFormRefreshedEventPayload => + payload.__typename === 'FormRefreshedEventPayload'; + export const useDiagramFilterSubscription = ( editingContextId: string, objectIds: string[], @@ -47,7 +49,6 @@ export const useDiagramFilterSubscription = ( ): UseDiagramFilterSubscriptionValue => { const [state, setState] = useState({ id: crypto.randomUUID(), - form: null, complete: false, }); @@ -59,20 +60,19 @@ export const useDiagramFilterSubscription = ( const variables: GQLDiagramFilterEventVariables = { input }; + const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); + const onData = ({ data }: OnDataOptions) => { const { data: gqlDiagramFilterEventSubscription } = data; if (gqlDiagramFilterEventSubscription) { const { diagramFilterEvent: payload } = gqlDiagramFilterEventSubscription; if (isFormRefreshedEventPayload(payload)) { - const { form } = payload; - setState((prevState) => ({ ...prevState, form, complete: false })); + setState((prevState) => ({ ...prevState, complete: false })); } } }; - const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); - - const { error, loading } = useSubscription( + const { data, error, loading } = useSubscription( gql(getDiagramFilterEventSubscription), { variables, @@ -92,7 +92,7 @@ export const useDiagramFilterSubscription = ( return { loading, - form: state.form, + payload: !!data?.diagramFilterEvent ? data.diagramFilterEvent : null, complete: state.complete, }; }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.types.ts index a30b4f7eaf6..58fa6abcc82 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/diagrams/useDiagramFilterSubscription.types.ts @@ -15,13 +15,12 @@ import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface UseDiagramFilterSubscriptionValue { loading: boolean; - form: GQLForm | null; + payload: GQLDiagramFilterEventPayload | null; complete: boolean; } export interface UseDiagramFilterSubscriptionState { id: string; - form: GQLForm | null; complete: boolean; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.tsx index f0e83f88e76..3a6086c437b 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.tsx @@ -17,6 +17,7 @@ import { useEffect, useState } from 'react'; import { makeStyles } from 'tss-react/mui'; import { DetailsViewState } from './DetailsView.types'; import { useDetailsViewSubscription } from './useDetailsViewSubscription'; +import { GQLDetailsEventPayload, GQLFormRefreshedEventPayload } from './useDetailsViewSubscription.types'; const useDetailsViewStyles = makeStyles()((theme) => ({ idle: { @@ -24,9 +25,13 @@ const useDetailsViewStyles = makeStyles()((theme) => ({ }, })); +const isFormRefreshedEventPayload = (payload: GQLDetailsEventPayload): payload is GQLFormRefreshedEventPayload => + payload && payload.__typename === 'FormRefreshedEventPayload'; + export const DetailsView = ({ editingContextId, readOnly }: WorkbenchViewComponentProps) => { const [state, setState] = useState({ currentSelection: { entries: [] }, + form: null, }); const { selection } = useSelection(); @@ -42,6 +47,7 @@ export const DetailsView = ({ editingContextId, readOnly }: WorkbenchViewCompone .map((entry) => entry.id) .sort() .join(':'); + useEffect(() => { if (selection.entries.length > 0 && currentSelectionKey !== newSelectionKey) { setState((prevState) => ({ ...prevState, currentSelection: selection })); @@ -52,11 +58,17 @@ export const DetailsView = ({ editingContextId, readOnly }: WorkbenchViewCompone const objectIds: string[] = state.currentSelection.entries.map((entry) => entry.id); const skip = objectIds.length === 0; - const { form, payload, complete } = useDetailsViewSubscription(editingContextId, objectIds, skip); + const { payload, complete } = useDetailsViewSubscription(editingContextId, objectIds, skip); + + useEffect(() => { + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, form: payload.form })); + } + }, [payload]); const { classes } = useDetailsViewStyles(); - if (!form || complete) { + if (!state.form || complete) { return (
No object selected @@ -69,7 +81,7 @@ export const DetailsView = ({ editingContextId, readOnly }: WorkbenchViewCompone value={{ payload: payload, }}> - +
); diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.types.ts index 344ee6595cb..7cee0ab6710 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/DetailsView.types.ts @@ -12,7 +12,9 @@ *******************************************************************************/ import { Selection } from '@eclipse-sirius/sirius-components-core'; +import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface DetailsViewState { currentSelection: Selection; + form: GQLForm | null; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.tsx index c803d08ed5b..4e3366aca49 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.tsx @@ -11,12 +11,19 @@ * Obeo - initial API and implementation *******************************************************************************/ import { useSelection, WorkbenchViewComponentProps } from '@eclipse-sirius/sirius-components-core'; -import { FormBasedView, GQLForm, Group } from '@eclipse-sirius/sirius-components-forms'; +import { + FormBasedView, + FormContext, + GQLForm, + GQLFormRefreshedEventPayload, + Group, +} from '@eclipse-sirius/sirius-components-forms'; import Typography from '@mui/material/Typography'; import { useEffect, useState } from 'react'; import { makeStyles } from 'tss-react/mui'; import { RelatedElementsViewState } from './RelatedElementsView.types'; import { useRelatedElementsViewSubscription } from './useRelatedElementsViewSubscription'; +import { GQLRelatedElementsEventPayload } from './useRelatedElementsViewSubscription.types'; const useRelatedElementsViewStyles = makeStyles()((theme) => ({ idle: { @@ -27,9 +34,14 @@ const useRelatedElementsViewStyles = makeStyles()((theme) => ({ }, })); +const isFormRefreshedEventPayload = ( + payload: GQLRelatedElementsEventPayload +): payload is GQLFormRefreshedEventPayload => payload && payload.__typename === 'FormRefreshedEventPayload'; + export const RelatedElementsView = ({ editingContextId, readOnly }: WorkbenchViewComponentProps) => { const [state, setState] = useState({ currentSelection: { entries: [] }, + form: null, }); const { selection } = useSelection(); @@ -55,7 +67,13 @@ export const RelatedElementsView = ({ editingContextId, readOnly }: WorkbenchVie const objectIds: string[] = state.currentSelection.entries.map((entry) => entry.id); const skip = objectIds.length === 0; - const { form, complete } = useRelatedElementsViewSubscription(editingContextId, objectIds, skip); + + const { payload, complete } = useRelatedElementsViewSubscription(editingContextId, objectIds, skip); + useEffect(() => { + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, form: payload.form })); + } + }, [payload]); const { classes } = useRelatedElementsViewStyles(); @@ -72,7 +90,7 @@ export const RelatedElementsView = ({ editingContextId, readOnly }: WorkbenchVie } }; - if (!form || complete) { + if (!state.form || complete) { return (
No object selected @@ -80,11 +98,18 @@ export const RelatedElementsView = ({ editingContextId, readOnly }: WorkbenchVie ); } return ( - +
+ + + +
); }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.types.ts index fcfa46fae4c..a267ede1d1b 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RelatedElementsView.types.ts @@ -12,7 +12,9 @@ *******************************************************************************/ import { Selection } from '@eclipse-sirius/sirius-components-core'; +import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface RelatedElementsViewState { currentSelection: Selection; + form: GQLForm | null; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.tsx index 3c2788a202c..274ce0c1055 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.tsx @@ -13,8 +13,10 @@ import { useSelection, WorkbenchViewComponentProps } from '@eclipse-sirius/sirius-components-core'; import { FormBasedView, + FormContext, GQLForm, GQLList, + GQLRepresentationsEventPayload, GQLTree, GQLWidget, ListPropertySection, @@ -25,6 +27,7 @@ import { useEffect, useState } from 'react'; import { makeStyles } from 'tss-react/mui'; import { RepresentationsViewState } from './RepresentationsView.types'; import { useRepresentationsViewSubscription } from './useRepresentationsViewSubscription'; +import { GQLFormRefreshedEventPayload } from './useRepresentationsViewSubscription.types'; const useRepresentationsViewStyles = makeStyles()((theme) => ({ idle: { @@ -37,10 +40,14 @@ const useRepresentationsViewStyles = makeStyles()((theme) => ({ const isList = (widget: GQLWidget | undefined): widget is GQLList => widget && widget.__typename === 'List'; const isTree = (widget: GQLWidget | undefined): widget is GQLTree => widget && widget.__typename === 'TreeWidget'; +const isFormRefreshedEventPayload = ( + payload: GQLRepresentationsEventPayload +): payload is GQLFormRefreshedEventPayload => payload && payload.__typename === 'FormRefreshedEventPayload'; export const RepresentationsView = ({ editingContextId, readOnly }: WorkbenchViewComponentProps) => { const [state, setState] = useState({ currentSelection: { entries: [] }, + form: null, }); const { selection } = useSelection(); @@ -66,7 +73,13 @@ export const RepresentationsView = ({ editingContextId, readOnly }: WorkbenchVie const objectIds: string[] = state.currentSelection.entries.map((entry) => entry.id); const skip = objectIds.length === 0; - const { form, complete } = useRepresentationsViewSubscription(editingContextId, objectIds, skip); + + const { payload, complete } = useRepresentationsViewSubscription(editingContextId, objectIds, skip); + useEffect(() => { + if (isFormRefreshedEventPayload(payload)) { + setState((prevState) => ({ ...prevState, form: payload.form })); + } + }, [payload]); const { classes } = useRepresentationsViewStyles(); @@ -99,7 +112,7 @@ export const RepresentationsView = ({ editingContextId, readOnly }: WorkbenchVie } }; - if (!form || complete) { + if (!state.form || complete) { return (
No object selected @@ -107,11 +120,18 @@ export const RepresentationsView = ({ editingContextId, readOnly }: WorkbenchVie ); } return ( - +
+ + + +
); }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.types.ts index 44fee3cab19..b8f55763531 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/RepresentationsView.types.ts @@ -12,7 +12,9 @@ *******************************************************************************/ import { Selection } from '@eclipse-sirius/sirius-components-core'; +import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface RepresentationsViewState { currentSelection: Selection; + form: GQLForm | null; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.tsx index f55a5a3c933..ae318a88e32 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.tsx @@ -13,21 +13,20 @@ import { gql, OnDataOptions, useSubscription } from '@apollo/client'; import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; -import { formRefreshedEventPayloadFragment } from '@eclipse-sirius/sirius-components-forms'; +import { + formRefreshedEventPayloadFragment, + GQLFormRefreshedEventPayload, +} from '@eclipse-sirius/sirius-components-forms'; import { useEffect, useState } from 'react'; import { GQLDetailsEventInput, GQLDetailsEventPayload, GQLDetailsEventSubscription, GQLDetailsEventVariables, - GQLFormRefreshedEventPayload, UseDetailsViewSubscriptionState, UseDetailsViewSubscriptionValue, } from './useDetailsViewSubscription.types'; -const isFormRefreshedEventPayload = (payload: GQLDetailsEventPayload): payload is GQLFormRefreshedEventPayload => - payload.__typename === 'FormRefreshedEventPayload'; - export const getDetailsViewEventSubscription = ` subscription detailsEvent($input: DetailsEventInput!) { detailsEvent(input: $input) { @@ -40,6 +39,9 @@ export const getDetailsViewEventSubscription = ` ${formRefreshedEventPayloadFragment} `; +const isFormRefreshedEventPayload = (payload: GQLDetailsEventPayload): payload is GQLFormRefreshedEventPayload => + payload.__typename === 'FormRefreshedEventPayload'; + export const useDetailsViewSubscription = ( editingContextId: string, objectIds: string[], @@ -47,7 +49,6 @@ export const useDetailsViewSubscription = ( ): UseDetailsViewSubscriptionValue => { const [state, setState] = useState({ id: crypto.randomUUID(), - form: null, complete: false, payload: null, }); @@ -60,21 +61,20 @@ export const useDetailsViewSubscription = ( const variables: GQLDetailsEventVariables = { input }; + const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); + const onData = ({ data }: OnDataOptions) => { const { data: gqlDetailsEventSubscription } = data; if (gqlDetailsEventSubscription) { const { detailsEvent: payload } = gqlDetailsEventSubscription; setState((prevState) => ({ ...prevState, payload, complete: false })); if (isFormRefreshedEventPayload(payload)) { - const { form } = payload; - setState((prevState) => ({ ...prevState, form, complete: false })); + setState((prevState) => ({ ...prevState, complete: false })); } } }; - const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); - - const { error, loading } = useSubscription( + const { data, error, loading } = useSubscription( gql(getDetailsViewEventSubscription), { variables, @@ -94,8 +94,7 @@ export const useDetailsViewSubscription = ( return { loading, - form: state.form, - payload: state.payload, + payload: !!data?.detailsEvent ? data.detailsEvent : null, complete: state.complete, }; }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.types.ts index 6a693c08c0b..9540da5d369 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useDetailsViewSubscription.types.ts @@ -15,14 +15,12 @@ import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface UseDetailsViewSubscriptionValue { loading: boolean; - form: GQLForm | null; payload: GQLDetailsEventPayload | null; complete: boolean; } export interface UseDetailsViewSubscriptionState { id: string; - form: GQLForm | null; complete: boolean; payload: GQLDetailsEventPayload | null; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.tsx index 80cdc83d1b4..9e80f38c2d2 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.tsx @@ -13,10 +13,12 @@ import { gql, OnDataOptions, useSubscription } from '@apollo/client'; import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; -import { formRefreshedEventPayloadFragment } from '@eclipse-sirius/sirius-components-forms'; -import { useEffect, useState } from 'react'; import { + formRefreshedEventPayloadFragment, GQLFormRefreshedEventPayload, +} from '@eclipse-sirius/sirius-components-forms'; +import { useEffect, useState } from 'react'; +import { GQLRelatedElementsEventInput, GQLRelatedElementsEventPayload, GQLRelatedElementsEventSubscription, @@ -25,10 +27,6 @@ import { UseRelatedElementsViewSubscriptionValue, } from './useRelatedElementsViewSubscription.types'; -const isFormRefreshedEventPayload = ( - payload: GQLRelatedElementsEventPayload -): payload is GQLFormRefreshedEventPayload => payload.__typename === 'FormRefreshedEventPayload'; - export const getRelatedElementsViewEventSubscription = ` subscription relatedElementsEvent($input: RelatedElementsEventInput!) { relatedElementsEvent(input: $input) { @@ -41,6 +39,10 @@ export const getRelatedElementsViewEventSubscription = ` ${formRefreshedEventPayloadFragment} `; +const isFormRefreshedEventPayload = ( + payload: GQLRelatedElementsEventPayload +): payload is GQLFormRefreshedEventPayload => payload.__typename === 'FormRefreshedEventPayload'; + export const useRelatedElementsViewSubscription = ( editingContextId: string, objectIds: string[], @@ -48,7 +50,6 @@ export const useRelatedElementsViewSubscription = ( ): UseRelatedElementsViewSubscriptionValue => { const [state, setState] = useState({ id: crypto.randomUUID(), - form: null, complete: false, }); @@ -60,29 +61,28 @@ export const useRelatedElementsViewSubscription = ( const variables: GQLRelatedElementsEventVariables = { input }; + const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); + const onData = ({ data }: OnDataOptions) => { const { data: gqlRelatedElementsEventSubscription } = data; if (gqlRelatedElementsEventSubscription) { const { relatedElementsEvent: payload } = gqlRelatedElementsEventSubscription; if (isFormRefreshedEventPayload(payload)) { - const { form } = payload; - setState((prevState) => ({ ...prevState, form, complete: false })); + setState((prevState) => ({ ...prevState, complete: false })); } } }; - const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); - - const { error, loading } = useSubscription( - gql(getRelatedElementsViewEventSubscription), - { - variables, - fetchPolicy: 'no-cache', - skip, - onData, - onComplete, - } - ); + const { data, error, loading } = useSubscription< + GQLRelatedElementsEventSubscription, + GQLRelatedElementsEventVariables + >(gql(getRelatedElementsViewEventSubscription), { + variables, + fetchPolicy: 'no-cache', + skip, + onData, + onComplete, + }); const { addErrorMessage } = useMultiToast(); useEffect(() => { @@ -93,7 +93,7 @@ export const useRelatedElementsViewSubscription = ( return { loading, - form: state.form, + payload: !!data?.relatedElementsEvent ? data.relatedElementsEvent : null, complete: state.complete, }; }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.types.ts index b258ab65994..03f1be4f98a 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRelatedElementsViewSubscription.types.ts @@ -15,13 +15,12 @@ import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface UseRelatedElementsViewSubscriptionValue { loading: boolean; - form: GQLForm | null; + payload: GQLRelatedElementsEventPayload | null; complete: boolean; } export interface UseRelatedElementsViewSubscriptionState { id: string; - form: GQLForm | null; complete: boolean; } diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.tsx b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.tsx index 70cb1024fdd..c2587c99565 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.tsx +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.tsx @@ -13,22 +13,20 @@ import { gql, OnDataOptions, useSubscription } from '@apollo/client'; import { useMultiToast } from '@eclipse-sirius/sirius-components-core'; -import { formRefreshedEventPayloadFragment } from '@eclipse-sirius/sirius-components-forms'; -import { useEffect, useState } from 'react'; import { + formRefreshedEventPayloadFragment, GQLFormRefreshedEventPayload, - GQLRepresentationsEventInput, GQLRepresentationsEventPayload, +} from '@eclipse-sirius/sirius-components-forms'; +import { useEffect, useState } from 'react'; +import { + GQLRepresentationsEventInput, GQLRepresentationsEventSubscription, GQLRepresentationsEventVariables, UseRepresentationsViewSubscriptionState, UseRepresentationsViewSubscriptionValue, } from './useRepresentationsViewSubscription.types'; -const isFormRefreshedEventPayload = ( - payload: GQLRepresentationsEventPayload -): payload is GQLFormRefreshedEventPayload => payload.__typename === 'FormRefreshedEventPayload'; - export const getRepresentationsViewEventSubscription = ` subscription representationsEvent($input: RepresentationsEventInput!) { representationsEvent(input: $input) { @@ -41,6 +39,10 @@ export const getRepresentationsViewEventSubscription = ` ${formRefreshedEventPayloadFragment} `; +const isFormRefreshedEventPayload = ( + payload: GQLRepresentationsEventPayload +): payload is GQLFormRefreshedEventPayload => payload.__typename === 'FormRefreshedEventPayload'; + export const useRepresentationsViewSubscription = ( editingContextId: string, objectIds: string[], @@ -48,7 +50,7 @@ export const useRepresentationsViewSubscription = ( ): UseRepresentationsViewSubscriptionValue => { const [state, setState] = useState({ id: crypto.randomUUID(), - form: null, + payload: null, complete: false, }); @@ -60,29 +62,28 @@ export const useRepresentationsViewSubscription = ( const variables: GQLRepresentationsEventVariables = { input }; + const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); + const onData = ({ data }: OnDataOptions) => { const { data: gqlRepresentationsEventSubscription } = data; if (gqlRepresentationsEventSubscription) { const { representationsEvent: payload } = gqlRepresentationsEventSubscription; if (isFormRefreshedEventPayload(payload)) { - const { form } = payload; - setState((prevState) => ({ ...prevState, form, complete: false })); + setState((prevState) => ({ ...prevState, complete: false })); } } }; - const onComplete = () => setState((prevState) => ({ ...prevState, complete: true })); - - const { error, loading } = useSubscription( - gql(getRepresentationsViewEventSubscription), - { - variables, - fetchPolicy: 'no-cache', - skip, - onData, - onComplete, - } - ); + const { data, error, loading } = useSubscription< + GQLRepresentationsEventSubscription, + GQLRepresentationsEventVariables + >(gql(getRepresentationsViewEventSubscription), { + variables, + fetchPolicy: 'no-cache', + skip, + onData, + onComplete, + }); const { addErrorMessage } = useMultiToast(); useEffect(() => { @@ -93,7 +94,7 @@ export const useRepresentationsViewSubscription = ( return { loading, - form: state.form, + payload: !!data?.representationsEvent ? data.representationsEvent : null, complete: state.complete, }; }; diff --git a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.types.ts b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.types.ts index 43d30305239..c5d224e58b0 100644 --- a/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.types.ts +++ b/packages/sirius-web/frontend/sirius-web-application/src/views/edit-project/workbench-views/useRepresentationsViewSubscription.types.ts @@ -15,13 +15,13 @@ import { GQLForm } from '@eclipse-sirius/sirius-components-forms'; export interface UseRepresentationsViewSubscriptionValue { loading: boolean; - form: GQLForm | null; + payload: GQLRepresentationsEventPayload | null; complete: boolean; } export interface UseRepresentationsViewSubscriptionState { id: string; - form: GQLForm | null; + payload: GQLRepresentationsEventPayload | null; complete: boolean; }