From 4b48c2c5d1805229988f9aaad655bf6442a78ca5 Mon Sep 17 00:00:00 2001 From: Michael Charfadi Date: Thu, 13 Jun 2024 17:51:57 +0200 Subject: [PATCH] [3627] Remove unused mutation in form MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug: https://github.com/eclipse-sirius/sirius-web/issues/3627 Signed-off-by: Michaƫl Charfadi --- CHANGELOG.adoc | 1 + .../forms/dto/UpdateWidgetFocusInput.java | 25 -- .../dto/UpdateWidgetFocusSuccessPayload.java | 30 -- .../handlers/UpdateWidgetFocusHandler.java | 43 --- .../src/main/resources/schema/form.graphqls | 16 - .../MutationUpdateWidgetFocusDataFetcher.java | 65 ---- .../ButtonPropertySection.tsx | 61 +--- .../ButtonPropertySection.types.ts | 24 +- .../CheckboxPropertySection.tsx | 62 +--- .../CheckboxPropertySection.types.ts | 24 +- .../DateTimeWidgetPropertySection.tsx | 48 +-- .../DateTimeWidgetPropertySection.types.ts | 18 - .../MultiSelectPropertySection.tsx | 74 +--- .../MultiSelectPropertySection.types.ts | 10 +- .../propertysections/RadioPropertySection.tsx | 67 +--- .../RadioPropertySection.types.ts | 24 +- .../RichTextPropertySection.tsx | 60 +-- .../RichTextPropertySection.types.ts | 24 +- .../SelectPropertySection.tsx | 63 +--- .../SelectPropertySection.types.ts | 10 +- .../SliderPropertySection.tsx | 61 +--- .../SliderPropertySection.types.ts | 24 +- .../SplitButtonPropertySection.tsx | 73 +--- .../SplitButtonPropertySection.types.ts | 21 -- .../TextfieldPropertySection.tsx | 60 +-- .../TextfieldPropertySection.types.ts | 24 +- .../propertysections/TreePropertySection.tsx | 79 +--- .../TreePropertySection.types.ts | 24 +- .../__tests__/ButtonPropertySection.test.tsx | 109 +----- .../CheckboxPropertySection.test.tsx | 154 ++------ .../__tests__/ListPropertySection.test.tsx | 52 +-- .../MultiSelectPropertySection.test.tsx | 42 +-- .../__tests__/RadioPropertySection.test.tsx | 208 +++-------- .../__tests__/SelectPropertySection.test.tsx | 43 +-- .../SplitButtonPropertySection.test.tsx | 72 +--- .../TextfieldPropertySection.test.tsx | 342 +++++------------- .../__tests__/TreePropertySection.test.tsx | 88 +---- .../ButtonPropertySection.test.tsx.snap | 33 -- .../ChartWidgetPropertySection.test.tsx.snap | 24 -- .../CheckboxPropertySection.test.tsx.snap | 43 +-- ...xboxContainerPropertySection.test.tsx.snap | 6 - .../ImagePropertySection.test.tsx.snap | 9 - .../LabelPropertySection.test.tsx.snap | 9 - .../ListPropertySection.test.tsx.snap | 18 - .../MultiSelectPropertySection.test.tsx.snap | 21 +- .../RadioPropertySection.test.tsx.snap | 69 +--- .../SelectPropertySection.test.tsx.snap | 21 +- .../SplitButtonPropertySection.test.tsx.snap | 24 -- .../TextfieldPropertySection.test.tsx.snap | 261 ++++--------- .../TreePropertySection.test.tsx.snap | 21 -- .../src/richtexteditor/RichTextEditor.tsx | 10 +- .../richtexteditor/RichTextEditor.types.ts | 4 +- .../src/toolbaraction/ToolbarAction.tsx | 63 +--- .../src/toolbaraction/ToolbarAction.types.ts | 24 +- .../sirius-components-forms/vitestSetup.js | 10 +- 55 files changed, 395 insertions(+), 2500 deletions(-) delete mode 100644 packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusInput.java delete mode 100644 packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusSuccessPayload.java delete mode 100644 packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/handlers/UpdateWidgetFocusHandler.java delete mode 100644 packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/mutation/MutationUpdateWidgetFocusDataFetcher.java diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index dd6ce09ce4e..bdf122f5e10 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -86,6 +86,7 @@ More existing APIs will be migrated to this new common pattern. image:doc/screenshots/insideLabelPositions.png[Inside label positions, 70%] - https://github.com/eclipse-sirius/sirius-web/issues/3574[#3574] [diagram] Add a loading indicator during execution of an arrange-all - https://github.com/eclipse-sirius/sirius-web/issues/3623[#3623] [form] Remove unused form payload +- https://github.com/eclipse-sirius/sirius-web/issues/3627[#3627] [form] Remove unused mutation in form == v2024.5.0 diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusInput.java b/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusInput.java deleted file mode 100644 index 0e917fd126a..00000000000 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusInput.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2023 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 - *******************************************************************************/ -package org.eclipse.sirius.components.collaborative.forms.dto; - -import java.util.UUID; - -import org.eclipse.sirius.components.collaborative.forms.api.IFormInput; - -/** - * The input of the update widget focus mutation. - * - * @author sbegaudeau - */ -public record UpdateWidgetFocusInput(UUID id, String editingContextId, String representationId, String widgetId, boolean selected) implements IFormInput { -} diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusSuccessPayload.java b/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusSuccessPayload.java deleted file mode 100644 index 1fa9b97efe7..00000000000 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/dto/UpdateWidgetFocusSuccessPayload.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 2023 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 - *******************************************************************************/ -package org.eclipse.sirius.components.collaborative.forms.dto; - -import java.util.Objects; -import java.util.UUID; - -import org.eclipse.sirius.components.core.api.IPayload; - -/** - * The payload of the "Widget Focus" mutation returned on success. - * - * @author smonnier - */ -public record UpdateWidgetFocusSuccessPayload(UUID id, String widgetId) implements IPayload { - public UpdateWidgetFocusSuccessPayload { - Objects.requireNonNull(id); - Objects.requireNonNull(widgetId); - } -} diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/handlers/UpdateWidgetFocusHandler.java b/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/handlers/UpdateWidgetFocusHandler.java deleted file mode 100644 index 6b7518499c9..00000000000 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/java/org/eclipse/sirius/components/collaborative/forms/handlers/UpdateWidgetFocusHandler.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * 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 - *******************************************************************************/ -package org.eclipse.sirius.components.collaborative.forms.handlers; - -import org.eclipse.sirius.components.collaborative.api.ChangeDescription; -import org.eclipse.sirius.components.collaborative.forms.api.IFormEventHandler; -import org.eclipse.sirius.components.collaborative.forms.api.IFormInput; -import org.eclipse.sirius.components.collaborative.forms.dto.UpdateWidgetFocusInput; -import org.eclipse.sirius.components.core.api.IEditingContext; -import org.eclipse.sirius.components.core.api.IPayload; -import org.eclipse.sirius.components.forms.Form; - -import org.springframework.stereotype.Service; - -import reactor.core.publisher.Sinks; - -/** - * Handler used to focus a widget. - * - * @author mcharfadi - */ -@Service -public class UpdateWidgetFocusHandler implements IFormEventHandler { - @Override - public boolean canHandle(IFormInput formInput) { - return formInput instanceof UpdateWidgetFocusInput; - } - - @Override - public void handle(Sinks.One payloadSink, Sinks.Many changeDescriptionSink, IEditingContext editingContext, Form form, IFormInput formInput) { - //Do nothing - } -} diff --git a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls index 1a8474adf30..43656c2b6e3 100644 --- a/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls +++ b/packages/forms/backend/sirius-components-collaborative-forms/src/main/resources/schema/form.graphqls @@ -452,7 +452,6 @@ extend type Mutation { editSelect(input: EditSelectInput!): EditSelectPayload! editTextfield(input: EditTextfieldInput!): EditTextfieldPayload! editRichText(input: EditRichTextInput!): EditRichTextPayload! - updateWidgetFocus(input: UpdateWidgetFocusInput!): UpdateWidgetFocusPayload! clickListItem(input: ClickListItemInput!): ClickListItemPayload! deleteListItem(input: DeleteListItemInput!): DeleteListItemPayload! pushButton(input: PushButtonInput!): PushButtonPayload! @@ -531,21 +530,6 @@ input EditRichTextInput { union EditRichTextPayload = ErrorPayload | SuccessPayload -input UpdateWidgetFocusInput { - id: ID! - editingContextId: ID! - representationId: ID! - widgetId: ID! - selected: Boolean! -} - -union UpdateWidgetFocusPayload = ErrorPayload | UpdateWidgetFocusSuccessPayload - -type UpdateWidgetFocusSuccessPayload { - id: ID! - updateFocusWidgetId: String! -} - input DeleteListItemInput { id: ID! editingContextId: ID! diff --git a/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/mutation/MutationUpdateWidgetFocusDataFetcher.java b/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/mutation/MutationUpdateWidgetFocusDataFetcher.java deleted file mode 100644 index aa0533ddf4f..00000000000 --- a/packages/forms/backend/sirius-components-forms-graphql/src/main/java/org/eclipse/sirius/components/forms/graphql/datafetchers/mutation/MutationUpdateWidgetFocusDataFetcher.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019, 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 - *******************************************************************************/ -package org.eclipse.sirius.components.forms.graphql.datafetchers.mutation; - -import com.fasterxml.jackson.databind.ObjectMapper; -import java.util.Objects; -import java.util.concurrent.CompletableFuture; - -import org.eclipse.sirius.components.annotations.spring.graphql.MutationDataFetcher; -import org.eclipse.sirius.components.collaborative.forms.dto.UpdateWidgetFocusInput; -import org.eclipse.sirius.components.core.api.IPayload; -import org.eclipse.sirius.components.graphql.api.IDataFetcherWithFieldCoordinates; -import org.eclipse.sirius.components.graphql.api.IEditingContextDispatcher; - -import graphql.schema.DataFetchingEnvironment; - -/** - * The data fetcher used to create a project. - *

- * It will be used to handle the following GraphQL field: - *

- * - *
- * type Mutation {
- *   updateWidgetFocus(input: UpdateWidgetFocusInput!): UpdateWidgetFocusPayload!
- * }
- * 
- * - * @author sbegaudeau - */ -@MutationDataFetcher(type = "Mutation", field = MutationUpdateWidgetFocusDataFetcher.UPDATE_WIDGET_FOCUS_FIELD) -public class MutationUpdateWidgetFocusDataFetcher implements IDataFetcherWithFieldCoordinates> { - - public static final String UPDATE_WIDGET_FOCUS_FIELD = "updateWidgetFocus"; - - private static final String INPUT_ARGUMENT = "input"; - - private final ObjectMapper objectMapper; - - private final IEditingContextDispatcher editingContextDispatcher; - - public MutationUpdateWidgetFocusDataFetcher(ObjectMapper objectMapper, IEditingContextDispatcher editingContextDispatcher) { - this.objectMapper = Objects.requireNonNull(objectMapper); - this.editingContextDispatcher = Objects.requireNonNull(editingContextDispatcher); - } - - @Override - public CompletableFuture get(DataFetchingEnvironment environment) throws Exception { - Object argument = environment.getArgument(INPUT_ARGUMENT); - var input = this.objectMapper.convertValue(argument, UpdateWidgetFocusInput.class); - - return this.editingContextDispatcher.dispatchMutation(input.editingContextId(), input).toFuture(); - } - -} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.tsx index ac2625f6b84..ea19bb2eeb2 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.tsx @@ -26,10 +26,6 @@ import { GQLPushButtonMutationVariables, GQLPushButtonPayload, GQLSuccessPayload, - GQLUpdateWidgetFocusInput, - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusMutationVariables, - GQLUpdateWidgetFocusPayload, } from './ButtonPropertySection.types'; import { PropertySectionLabel } from './PropertySectionLabel'; import { getTextDecorationLineValue } from './getTextDecorationLineValue'; @@ -85,24 +81,10 @@ export const pushButtonMutation = gql` } `; -export const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - -const isErrorPayload = (payload: GQLPushButtonPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLPushButtonPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = (payload: GQLPushButtonPayload | GQLUpdateWidgetFocusPayload): payload is GQLSuccessPayload => +const isSuccessPayload = (payload: GQLPushButtonPayload): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; /** @@ -149,43 +131,6 @@ export const ButtonPropertySection: PropertySectionComponent = ({ } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => { - sendUpdateWidgetFocus(false); - }; const onClick = () => { const input: GQLPushButtonInput = { id: crypto.randomUUID(), @@ -210,8 +155,6 @@ export const ButtonPropertySection: PropertySectionComponent = ({ variant="contained" color="primary" onClick={onClick} - onBlur={onBlur} - onFocus={onFocus} disabled={readOnly || widget.readOnly} classes={{ root: classes.style }}> {widget.imageURL?.length > 0 ? ( diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.types.ts index a82149d221c..20cd52715bf 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/ButtonPropertySection.types.ts @@ -54,28 +54,6 @@ export interface GQLSuccessPayload extends GQLPushButtonPayload { messages: GQLMessage[]; } -export interface GQLErrorPayload extends GQLPushButtonPayload, GQLUpdateWidgetFocusPayload { +export interface GQLErrorPayload extends GQLPushButtonPayload { messages: GQLMessage[]; } - -export interface GQLUpdateWidgetFocusMutationVariables { - input: GQLUpdateWidgetFocusInput; -} - -export interface GQLUpdateWidgetFocusInput { - id: string; - editingContextId: string; - representationId: string; - widgetId: string; - selected: boolean; -} - -export interface GQLUpdateWidgetFocusMutationData { - updateWidgetFocus: GQLUpdateWidgetFocusPayload; -} - -export interface GQLUpdateWidgetFocusPayload { - __typename: string; -} - -export interface GQLUpdateWidgetFocusSuccessPayload extends GQLUpdateWidgetFocusPayload {} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.tsx index bd904dc984a..e07aa7f92c5 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.tsx @@ -28,10 +28,6 @@ import { GQLEditCheckboxPayload, GQLErrorPayload, GQLSuccessPayload, - GQLUpdateWidgetFocusInput, - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusMutationVariables, - GQLUpdateWidgetFocusPayload, } from './CheckboxPropertySection.types'; import { PropertySectionLabel } from './PropertySectionLabel'; @@ -67,25 +63,10 @@ export const editCheckboxMutation = gql` } `; -export const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - -const isErrorPayload = (payload: GQLEditCheckboxPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLEditCheckboxPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = ( - payload: GQLEditCheckboxPayload | GQLUpdateWidgetFocusPayload -): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; +const isSuccessPayload = (payload: GQLEditCheckboxPayload): payload is GQLSuccessPayload => + payload.__typename === 'SuccessPayload'; export const CheckboxPropertySection: PropertySectionComponent = ({ editingContextId, @@ -130,41 +111,6 @@ export const CheckboxPropertySection: PropertySectionComponent = ({ } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => sendUpdateWidgetFocus(false); - return ( 0}> = ({ color="default" checked={widget.booleanValue} onChange={onChange} - onFocus={onFocus} - onBlur={onBlur} data-testid={widget.label} disabled={readOnly || widget.readOnly} classes={{ root: classes.style, disabled: classes.disabled }} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.types.ts index 2f583964cfa..c4492956feb 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/CheckboxPropertySection.types.ts @@ -24,7 +24,7 @@ export interface GQLEditCheckboxPayload { __typename: string; } -export interface GQLErrorPayload extends GQLEditCheckboxPayload, GQLUpdateWidgetFocusPayload { +export interface GQLErrorPayload extends GQLEditCheckboxPayload { messages: GQLMessage[]; } @@ -32,14 +32,6 @@ export interface GQLSuccessPayload extends GQLEditCheckboxPayload { messages: GQLMessage[]; } -export interface GQLUpdateWidgetFocusMutationData { - updateWidgetFocus: GQLUpdateWidgetFocusPayload; -} - -export interface GQLUpdateWidgetFocusPayload { - __typename: string; -} - export interface GQLEditCheckboxMutationVariables { input: GQLEditCheckboxInput; } @@ -51,17 +43,3 @@ export interface GQLEditCheckboxInput { checkboxId: string; newValue: boolean; } - -export interface GQLUpdateWidgetFocusMutationVariables { - input: GQLUpdateWidgetFocusInput; -} - -export interface GQLUpdateWidgetFocusInput { - id: string; - editingContextId: string; - representationId: string; - widgetId: string; - selected: boolean; -} - -export interface GQLUpdateWidgetFocusSuccessPayload extends GQLUpdateWidgetFocusPayload {} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.tsx index 5a54bb36d05..66105bcdd75 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.tsx @@ -23,9 +23,6 @@ import { GQLEditDateTimeInput, GQLEditDateTimeMutationData, GQLEditDateTimeMutationVariables, - GQLUpdateWidgetFocusInput, - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusMutationVariables, } from './DateTimeWidgetPropertySection.types'; import { PropertySectionLabel } from './PropertySectionLabel'; @@ -42,20 +39,6 @@ const useStyle = makeStyles((theme) => ({ }, })); -export const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - export const editDateTimeMutation = gql` mutation editDateTime($input: EditDateTimeInput!) { editDateTime(input: $input) { @@ -98,26 +81,6 @@ export const DateTimeWidgetPropertySection: PropertySectionComponent ({ ...prevState, editedValue: widget.stringValue })); }, [widget.stringValue]); - const [updateWidgetFocus, mutationUpdateWidgetFocusResult] = useMutation< - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusMutationVariables - >(updateWidgetFocusMutation); - - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - useReporting(mutationUpdateWidgetFocusResult, (data: GQLUpdateWidgetFocusMutationData) => data?.updateWidgetFocus); - const [editDateTime, mutationEditDateTimeResult] = useMutation< GQLEditDateTimeMutationData, GQLEditDateTimeMutationVariables @@ -140,18 +103,16 @@ export const DateTimeWidgetPropertySection: PropertySectionComponent data?.editDateTime); - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => { - sendUpdateWidgetFocus(false); - sendEditedValue(); - }; - const onKeyPress: React.KeyboardEventHandler = (event) => { if ('Enter' === event.key) { sendEditedValue(); } }; + const onBlur = () => { + sendEditedValue(); + }; + const onChange = (event: React.ChangeEvent) => { const { value } = event.target; if (value?.length > 0) { @@ -192,7 +153,6 @@ export const DateTimeWidgetPropertySection: PropertySectionComponent diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.types.ts index c229543a5a6..03682d4ed25 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/DateTimeWidgetPropertySection.types.ts @@ -23,24 +23,6 @@ export interface DataTimeWidgetPropertySectionState { editedValue: string; } -export interface GQLUpdateWidgetFocusMutationVariables { - input: GQLUpdateWidgetFocusInput; -} - -export interface GQLUpdateWidgetFocusInput { - id: string; - editingContextId: string; - representationId: string; - widgetId: string; - selected: boolean; -} - -export interface GQLUpdateWidgetFocusMutationData { - updateWidgetFocus: GQLUpdateWidgetFocusPayload; -} - -export type GQLUpdateWidgetFocusPayload = GQLErrorPayload | GQLSuccessPayload; - export interface GQLEditDateTimeMutationData { editDateTime: GQLEditDataTimePayload; } diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx index aaebd8c7d4d..cf5df3b9456 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/MultiSelectPropertySection.tsx @@ -20,7 +20,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import MenuItem from '@material-ui/core/MenuItem'; import Select from '@material-ui/core/Select'; import { Theme, makeStyles } from '@material-ui/core/styles'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { PropertySectionComponent, PropertySectionComponentProps } from '../form/Form.types'; import { GQLMultiSelect } from '../form/FormEventFragments.types'; import { @@ -28,8 +28,6 @@ import { GQLEditMultiSelectPayload, GQLErrorPayload, GQLSuccessPayload, - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusPayload, MultiSelectStyleProps, } from './MultiSelectPropertySection.types'; import { PropertySectionLabel } from './PropertySectionLabel'; @@ -71,25 +69,11 @@ export const editMultiSelectMutation = gql` } `; -const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - -const isErrorPayload = (payload: GQLEditMultiSelectPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLEditMultiSelectPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = ( - payload: GQLEditMultiSelectPayload | GQLUpdateWidgetFocusPayload -): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; + +const isSuccessPayload = (payload: GQLEditMultiSelectPayload): payload is GQLSuccessPayload => + payload.__typename === 'SuccessPayload'; export const MultiSelectPropertySection: PropertySectionComponent = ({ editingContextId, @@ -108,8 +92,6 @@ export const MultiSelectPropertySection: PropertySectionComponent(editMultiSelectMutation); const onChange = (event) => { @@ -142,50 +124,6 @@ export const MultiSelectPropertySection: PropertySectionComponent(updateWidgetFocusMutation); - - const sendUpdateWidgetFocus = (selected: boolean) => { - const variables = { - input: { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => { - if (!isFocused) { - setFocus(true); - sendUpdateWidgetFocus(true); - } - }; - - const onBlur = () => { - setFocus(false); - sendUpdateWidgetFocus(false); - }; - return ( 0}> @@ -193,8 +131,6 @@ export const MultiSelectPropertySection: PropertySectionComponent((theme) => ({ radioGroupRoot: { flexDirection: 'row', @@ -91,9 +73,9 @@ const useRadioPropertySectionStyles = makeStyles((theme) }, })); -const isErrorPayload = (payload: GQLEditRadioPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLEditRadioPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = (payload: GQLEditRadioPayload | GQLUpdateWidgetFocusPayload): payload is GQLSuccessPayload => +const isSuccessPayload = (payload: GQLEditRadioPayload): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; export const RadioPropertySection: PropertySectionComponent = ({ @@ -143,41 +125,6 @@ export const RadioPropertySection: PropertySectionComponent = ({ } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => sendUpdateWidgetFocus(false); - const selectedOption = widget.options.find((option) => option.selected); return ( 0}> @@ -191,15 +138,7 @@ export const RadioPropertySection: PropertySectionComponent = ({ {widget.options.map((option) => ( - } + control={} label={ +const isErrorPayload = (payload: GQLEditRichTextPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = ( - payload: GQLEditRichTextPayload | GQLUpdateWidgetFocusPayload -): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; +const isSuccessPayload = (payload: GQLEditRichTextPayload): payload is GQLSuccessPayload => + payload.__typename === 'SuccessPayload'; /** * Defines the content of a Rich Text property section. @@ -111,41 +92,7 @@ export const RichTextPropertySection: PropertySectionComponent = ({ } }, [updateRichTextLoading, updateRichTextData, updateRichTextError]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); const onBlur = (currentText: string) => { - sendUpdateWidgetFocus(false); if (currentText !== widget.stringValue) { sendEditedValue(currentText); } @@ -158,7 +105,6 @@ export const RichTextPropertySection: PropertySectionComponent = ({ diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/RichTextPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/RichTextPropertySection.types.ts index 5cfc881ef45..b5916f854d3 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/RichTextPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/RichTextPropertySection.types.ts @@ -37,28 +37,6 @@ export interface GQLSuccessPayload extends GQLEditRichTextPayload { messages: GQLMessage[]; } -export interface GQLErrorPayload extends GQLEditRichTextPayload, GQLUpdateWidgetFocusPayload { +export interface GQLErrorPayload extends GQLEditRichTextPayload { messages: GQLMessage[]; } - -export interface GQLUpdateWidgetFocusMutationVariables { - input: GQLUpdateWidgetFocusInput; -} - -export interface GQLUpdateWidgetFocusInput { - id: string; - editingContextId: string; - representationId: string; - widgetId: string; - selected: boolean; -} - -export interface GQLUpdateWidgetFocusMutationData { - updateWidgetFocus: GQLUpdateWidgetFocusPayload; -} - -export interface GQLUpdateWidgetFocusPayload { - __typename: string; -} - -export interface GQLUpdateWidgetFocusSuccessPayload extends GQLUpdateWidgetFocusPayload {} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.tsx index 69cde21fa5e..f85f3279048 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.tsx @@ -18,7 +18,7 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'; import MenuItem from '@material-ui/core/MenuItem'; import Select from '@material-ui/core/Select'; import { Theme, makeStyles } from '@material-ui/core/styles'; -import { useEffect, useState } from 'react'; +import { useEffect } from 'react'; import { PropertySectionComponent, PropertySectionComponentProps } from '../form/Form.types'; import { GQLSelect } from '../form/FormEventFragments.types'; import { PropertySectionLabel } from './PropertySectionLabel'; @@ -27,7 +27,6 @@ import { GQLEditSelectPayload, GQLErrorPayload, GQLSuccessPayload, - GQLUpdateWidgetFocusMutationData, SelectStyleProps, } from './SelectPropertySection.types'; import { getTextDecorationLineValue } from './getTextDecorationLineValue'; @@ -66,20 +65,6 @@ export const editSelectMutation = gql` } `; -const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - const isErrorPayload = (payload: GQLEditSelectPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; const isSuccessPayload = (payload: GQLEditSelectPayload): payload is GQLSuccessPayload => @@ -102,8 +87,6 @@ export const SelectPropertySection: PropertySectionComponent = ({ }; const classes = useStyle(props); - const [isFocused, setFocus] = useState(false); - const [editSelect, { loading, error, data }] = useMutation(editSelectMutation); const onChange = (event) => { const newValue = event.target.value; @@ -135,48 +118,6 @@ export const SelectPropertySection: PropertySectionComponent = ({ } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - const sendUpdateWidgetFocus = (selected: boolean) => { - const variables = { - input: { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => { - if (!isFocused) { - setFocus(true); - sendUpdateWidgetFocus(true); - } - }; - const onBlur = () => { - setFocus(false); - sendUpdateWidgetFocus(false); - }; - return ( 0}> @@ -184,8 +125,6 @@ export const SelectPropertySection: PropertySectionComponent = ({ value={widget.value || ''} onChange={onChange} displayEmpty - onFocus={onFocus} - onBlur={onBlur} fullWidth data-testid={widget.label} disabled={readOnly || widget.readOnly} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.types.ts b/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.types.ts index a83aad2b6d4..27ed7589c37 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.types.ts +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/SelectPropertySection.types.ts @@ -30,18 +30,10 @@ export interface GQLEditSelectPayload { __typename: string; } -export interface GQLErrorPayload extends GQLEditSelectPayload, GQLUpdateWidgetFocusPayload { +export interface GQLErrorPayload extends GQLEditSelectPayload { messages: GQLMessage[]; } export interface GQLSuccessPayload extends GQLEditSelectPayload { messages: GQLMessage[]; } - -export interface GQLUpdateWidgetFocusMutationData { - updateWidgetFocus: GQLUpdateWidgetFocusPayload; -} - -export interface GQLUpdateWidgetFocusPayload { - __typename: string; -} diff --git a/packages/forms/frontend/sirius-components-forms/src/propertysections/SliderPropertySection.tsx b/packages/forms/frontend/sirius-components-forms/src/propertysections/SliderPropertySection.tsx index 54e2f9f85b5..db150833537 100644 --- a/packages/forms/frontend/sirius-components-forms/src/propertysections/SliderPropertySection.tsx +++ b/packages/forms/frontend/sirius-components-forms/src/propertysections/SliderPropertySection.tsx @@ -25,10 +25,6 @@ import { GQLEditSliderPayload, GQLErrorPayload, GQLSuccessPayload, - GQLUpdateWidgetFocusInput, - GQLUpdateWidgetFocusMutationData, - GQLUpdateWidgetFocusMutationVariables, - GQLUpdateWidgetFocusPayload, } from './SliderPropertySection.types'; export const editSliderMutation = gql` @@ -51,23 +47,9 @@ export const editSliderMutation = gql` } `; -export const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - -const isErrorPayload = (payload: GQLEditSliderPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLEditSliderPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = (payload: GQLEditSliderPayload | GQLUpdateWidgetFocusPayload): payload is GQLSuccessPayload => +const isSuccessPayload = (payload: GQLEditSliderPayload): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; export const SliderPropertySection: PropertySectionComponent = ({ @@ -95,43 +77,6 @@ export const SliderPropertySection: PropertySectionComponent = ({ } } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => { - sendUpdateWidgetFocus(false); - }; const onValueChanged = (_, value) => { const input: GQLEditSliderInput = { @@ -161,8 +106,6 @@ export const SliderPropertySection: PropertySectionComponent = ({ ((theme) => ({ @@ -86,20 +79,6 @@ const useContainerStyle = makeStyles((theme) => ({ }, })); -export const updateWidgetFocusMutation = gql` - mutation updateWidgetFocus($input: UpdateWidgetFocusInput!) { - updateWidgetFocus(input: $input) { - __typename - ... on ErrorPayload { - messages { - body - level - } - } - } - } -`; - export const pushButtonMutation = gql` mutation pushButton($input: PushButtonInput!) { pushButton(input: $input) { @@ -120,10 +99,10 @@ export const pushButtonMutation = gql` } `; -const isErrorPayload = (payload: GQLPushButtonPayload | GQLUpdateWidgetFocusPayload): payload is GQLErrorPayload => +const isErrorPayload = (payload: GQLPushButtonPayload): payload is GQLErrorPayload => payload.__typename === 'ErrorPayload'; -const isSuccessPayload = (payload: GQLPushButtonPayload | GQLUpdateWidgetFocusPayload): payload is GQLSuccessPayload => +const isSuccessPayload = (payload: GQLPushButtonPayload): payload is GQLSuccessPayload => payload.__typename === 'SuccessPayload'; export const SplitButtonPropertySection = ({ @@ -188,44 +167,6 @@ export const SplitButtonPropertySection = ({ } }, [loading, error, data]); - const [ - updateWidgetFocus, - { loading: updateWidgetFocusLoading, data: updateWidgetFocusData, error: updateWidgetFocusError }, - ] = useMutation(updateWidgetFocusMutation); - - const sendUpdateWidgetFocus = (selected: boolean) => { - const input: GQLUpdateWidgetFocusInput = { - id: crypto.randomUUID(), - editingContextId, - representationId: formId, - widgetId: widget.id, - selected, - }; - const variables: GQLUpdateWidgetFocusMutationVariables = { - input, - }; - updateWidgetFocus({ variables }); - }; - - useEffect(() => { - if (!updateWidgetFocusLoading) { - if (updateWidgetFocusError) { - addErrorMessage('An unexpected error has occurred, please refresh the page'); - } - if (updateWidgetFocusData) { - const { updateWidgetFocus } = updateWidgetFocusData; - if (isErrorPayload(updateWidgetFocus)) { - addMessages(updateWidgetFocus.messages); - } - } - } - }, [updateWidgetFocusLoading, updateWidgetFocusData, updateWidgetFocusError]); - - const onFocus = () => sendUpdateWidgetFocus(true); - const onBlur = () => { - sendUpdateWidgetFocus(false); - }; - const handleClick = () => { const button: GQLButton = widget.actions[state.selectedIndex]; const input: GQLPushButtonInput = { @@ -261,13 +202,7 @@ export const SplitButtonPropertySection = ({ widget={widget} data-testid={widget.label} /> - +