From 190c2359c7cead3eb859ec3da0aa3ddd3e032f2b Mon Sep 17 00:00:00 2001 From: andreastanderen <71079896+standeren@users.noreply.github.com> Date: Thu, 26 Oct 2023 12:58:56 +0200 Subject: [PATCH] use empty array for layouts if not yet loaded when changing layoutset (#11340) * Set layouts as empty array if not loaded yet * Move selected layout set to global ux-editor context * fix tests * Add tests * Move MapIformLayoutsToLayouts outside of comopnent * Filter out eventlistener on window from useLocalStorage hook to separate useReactiveLocalStorage hook --- .../Designer/Controllers/PreviewController.cs | 2 +- .../DeleteAttachmentTests.cs | 4 +- .../PreviewController/GetFormDataTests.cs | 8 +-- .../InstanceForNextTaskTests.cs | 4 +- .../PreviewController/InstancesTests.cs | 4 +- .../PreviewController/PostAttachmentTests.cs | 4 +- .../PreviewController/ProcessNextTests.cs | 4 +- .../PreviewController/ProcessTests.cs | 4 +- .../PreviewController/UpdateFormDataTests.cs | 2 +- .../UpdateProcessNextTests.cs | 4 +- .../app-preview/src/views/LandingPage.tsx | 10 ++-- .../shared/src/hooks/useEventListener.test.ts | 39 ++++++++++++++ .../shared/src/hooks/useEventListener.ts | 16 ++++++ .../shared/src/hooks/useLocalStorage.ts | 4 +- .../src/hooks/useReactiveLocalStorage.ts | 20 +++++++ .../providers/PreviewConnectionContext.tsx | 2 +- .../packages/shared/src/utils/webStorage.ts | 2 +- frontend/packages/ux-editor/src/App.test.tsx | 28 +++++----- frontend/packages/ux-editor/src/App.tsx | 48 +++++------------ frontend/packages/ux-editor/src/AppContext.ts | 7 +-- frontend/packages/ux-editor/src/SubApp.tsx | 7 ++- .../src/components/Elements/Elements.tsx | 11 ++-- .../Elements/LayoutSetsContainer.test.tsx | 51 ++++++++++-------- .../Elements/LayoutSetsContainer.tsx | 13 ++--- .../FormComponent/FormComponent.tsx | 8 ++- .../src/components/Preview/Preview.tsx | 7 +-- .../components/config/EditFormContainer.tsx | 10 ++-- .../config/Expressions/DataSourceValue.tsx | 5 +- .../toolbar/ConditionalRenderingModal.tsx | 11 ++-- .../src/components/toolbar/RuleModal.tsx | 5 +- .../src/containers/DesignView/DesignView.tsx | 52 ++++++++----------- .../NavigationMenu/NavigationMenu.tsx | 4 +- .../FormContainer/FormContainer.tsx | 7 ++- .../ux-editor/src/containers/FormContext.tsx | 18 +++---- .../formLayout/formLayoutSlice.ts | 5 +- .../useAddItemToLayoutMutation.test.ts | 2 +- .../useConfigureLayoutSetMutation.test.ts | 21 ++++++++ .../useConfigureLayoutSetMutation.ts | 7 ++- .../src/hooks/useFormLayoutsSelector.ts | 5 +- .../src/selectors/formLayoutSelectors.test.ts | 8 +-- .../src/selectors/formLayoutSelectors.ts | 3 -- .../ux-editor/src/testing/appContextMock.ts | 5 +- .../packages/ux-editor/src/testing/mocks.tsx | 2 +- 43 files changed, 268 insertions(+), 215 deletions(-) create mode 100644 frontend/packages/shared/src/hooks/useEventListener.test.ts create mode 100644 frontend/packages/shared/src/hooks/useEventListener.ts create mode 100644 frontend/packages/shared/src/hooks/useReactiveLocalStorage.ts create mode 100644 frontend/packages/ux-editor/src/hooks/mutations/useConfigureLayoutSetMutation.test.ts diff --git a/backend/src/Designer/Controllers/PreviewController.cs b/backend/src/Designer/Controllers/PreviewController.cs index eba1205149b..2f0d7d1de00 100644 --- a/backend/src/Designer/Controllers/PreviewController.cs +++ b/backend/src/Designer/Controllers/PreviewController.cs @@ -849,7 +849,7 @@ public IActionResult UpdateAttachmentWithTag(string org, string app, [FromQuery] private string GetSelectedLayoutSetInEditorFromRefererHeader(string refererHeader) { Uri refererUri = new(refererHeader); - string layoutSetName = HttpUtility.ParseQueryString(refererUri.Query)["selectedLayoutSetInEditor"]; + string layoutSetName = HttpUtility.ParseQueryString(refererUri.Query)["selectedLayoutSet"]; return string.IsNullOrEmpty(layoutSetName) ? null : layoutSetName; } diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/DeleteAttachmentTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/DeleteAttachmentTests.cs index 0ee46612cab..c18b2e418e7 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/DeleteAttachmentTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/DeleteAttachmentTests.cs @@ -19,7 +19,7 @@ public async Task Delete_Attachment_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/data/{AttachmentGuId}"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Delete, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -30,7 +30,7 @@ public async Task Delete_AttachmentForStateFulApp_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/data/{AttachmentGuId}"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Delete, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/GetFormDataTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/GetFormDataTests.cs index ab77e8cb537..05ce8da85bc 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/GetFormDataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/GetFormDataTests.cs @@ -24,7 +24,7 @@ public async Task Get_FormData_Ok() string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/data/test-datatask-id"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -38,7 +38,7 @@ public async Task Get_FormDataForAppWithoutDatamodel_Ok() { string dataPathWithData = $"{Org}/empty-app/instances/{PartyId}/{InstanceGuId}/data/test-datatask-id"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -54,7 +54,7 @@ public async Task Get_FormDataForStatefulApp_Ok() string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/data/test-datatask-id"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -68,7 +68,7 @@ public async Task Get_FormDataForStatefulAppForTaskWithoutDatamodel_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/data/test-datatask-id"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName2}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName2}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/InstanceForNextTaskTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/InstanceForNextTaskTests.cs index 9f74248d81d..64101fb7118 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/InstanceForNextTaskTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/InstanceForNextTaskTests.cs @@ -22,7 +22,7 @@ public async Task Get_InstanceForNextProcess_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -39,7 +39,7 @@ public async Task Get_InstanceForNextTaskForStatefulApp_Ok_TaskIsIncreased() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/InstancesTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/InstancesTests.cs index 5e144a0be4d..b34f76acb73 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/InstancesTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/InstancesTests.cs @@ -26,7 +26,7 @@ public async Task Post_Instance_Ok() string dataPathWithData = $"{Org}/{targetRepository}/instances?instanceOwnerPartyId=51001"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Post, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -46,7 +46,7 @@ public async Task Post_InstanceForStatefulApp_Ok() string dataPathWithData = $"{Org}/{targetRepository}/instances?instanceOwnerPartyId=51001"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Post, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/PostAttachmentTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/PostAttachmentTests.cs index cb4d8d55def..ac4290b66a1 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/PostAttachmentTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/PostAttachmentTests.cs @@ -20,7 +20,7 @@ public async Task Post_Attachment_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/data?dataType=FileUploadId"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Post, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.Created, response.StatusCode); @@ -31,7 +31,7 @@ public async Task Post_AttachmentForStateFulApp_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/data?dataType=FileUploadId"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Post, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(StatusCodes.Status201Created, (int)response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessNextTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessNextTests.cs index bbbe4f4fee5..4186499d052 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessNextTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessNextTests.cs @@ -22,7 +22,7 @@ public async Task Get_ProcessNext_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/process/next"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -39,7 +39,7 @@ public async Task Get_ProcessNextForStatefulApp_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/process/next"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessTests.cs index 90d7c272297..2244275d508 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/ProcessTests.cs @@ -22,7 +22,7 @@ public async Task Get_Process_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/process"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -39,7 +39,7 @@ public async Task Get_ProcessForStatefulApp_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/process"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Get, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateFormDataTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateFormDataTests.cs index 485e674d1c1..561d878d350 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateFormDataTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateFormDataTests.cs @@ -19,7 +19,7 @@ public async Task Put_UpdateFormData_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/data/test-datatask-id"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Put, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(StatusCodes.Status200OK, (int)response.StatusCode); diff --git a/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateProcessNextTests.cs b/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateProcessNextTests.cs index df9441628bc..11a306bc156 100644 --- a/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateProcessNextTests.cs +++ b/backend/tests/Designer.Tests/Controllers/PreviewController/UpdateProcessNextTests.cs @@ -22,7 +22,7 @@ public async Task Put_ProcessNext_Ok() { string dataPathWithData = $"{Org}/{App}/instances/{PartyId}/{InstanceGuId}/process/next"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Put, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSetInEditor="); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={App}&selectedLayoutSet="); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); @@ -36,7 +36,7 @@ public async Task Put_ProcessNextForStatefulAppForNonExistingTask_Ok() { string dataPathWithData = $"{Org}/{StatefulApp}/instances/{PartyId}/{InstanceGuId}/process/next"; using HttpRequestMessage httpRequestMessage = new(HttpMethod.Put, dataPathWithData); - httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSetInEditor={LayoutSetName}"); + httpRequestMessage.Headers.Referrer = new Uri($"{MockedReferrerUrl}?org={Org}&app={StatefulApp}&selectedLayoutSet={LayoutSetName}"); using HttpResponseMessage response = await HttpClient.SendAsync(httpRequestMessage); Assert.Equal(HttpStatusCode.OK, response.StatusCode); diff --git a/frontend/app-preview/src/views/LandingPage.tsx b/frontend/app-preview/src/views/LandingPage.tsx index dd5d08647cd..4c0100deb1e 100644 --- a/frontend/app-preview/src/views/LandingPage.tsx +++ b/frontend/app-preview/src/views/LandingPage.tsx @@ -35,9 +35,7 @@ export const LandingPage = ({ variant = 'preview' }: LandingPageProps) => { const [openSaveChoiceInSession, setOpenShowSaveChoiceInSession] = useState(false); const showPreviewLimitationsInfoSession: boolean = typedSessionStorage.getItem('showPreviewLimitationsInfo'); const [showPreviewLimitationsInfo, setShowPreviewLimitationsInfo] = useState(showPreviewLimitationsInfoSession ?? true); - const [selectedLayoutSetInEditor, setSelectedLayoutSetInEditor] = useLocalStorage( - 'layoutSet/' + app, - ); + const [selectedLayoutSet, setSelectedLayoutSet] = useLocalStorage('layoutSet/' + app, null); const [previewViewSize, setPreviewViewSize] = useLocalStorage( 'viewSize', 'desktop', @@ -49,7 +47,7 @@ export const LandingPage = ({ variant = 'preview' }: LandingPageProps) => { input !== null && input.tagName === 'IFRAME'; const handleChangeLayoutSet = (layoutSet: string) => { - setSelectedLayoutSetInEditor(layoutSet); + setSelectedLayoutSet(layoutSet); // might need to remove selected layout from local storage to make sure first page is selected window.location.reload(); }; @@ -94,7 +92,7 @@ export const LandingPage = ({ variant = 'preview' }: LandingPageProps) => { } @@ -121,7 +119,7 @@ export const LandingPage = ({ variant = 'preview' }: LandingPageProps) => {