From 05de2ef4c1b22c937d5ab7d039830a21253eeff5 Mon Sep 17 00:00:00 2001 From: AlexS Date: Thu, 22 Jun 2023 01:31:00 +0300 Subject: [PATCH] Fix works of EntityReference component inside SubForm --- .../src/components/quickView/index.tsx | 33 ++++++++++--------- .../src/pages/dynamic/index.stories.tsx | 2 ++ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/shesha-reactjs/src/components/quickView/index.tsx b/shesha-reactjs/src/components/quickView/index.tsx index 7996fb2a7..65bdabf81 100644 --- a/shesha-reactjs/src/components/quickView/index.tsx +++ b/shesha-reactjs/src/components/quickView/index.tsx @@ -1,8 +1,8 @@ import { Button, Form, Popover, PopoverProps, Spin, notification } from 'antd'; import { entitiesGet } from 'apis/entities'; -import React, { FC, PropsWithChildren, useEffect, useState } from 'react'; +import React, { FC, PropsWithChildren, useEffect, useMemo, useState } from 'react'; import { ConfigurableForm } from '../'; -import { FormMarkupWithSettings, useSheshaApplication, useUi } from '../../providers'; +import { FormItemProvider, FormMarkupWithSettings, useSheshaApplication, useUi } from '../../providers'; import { useConfigurationItemsLoader } from '../../providers/configurationItemsLoader'; import { useFormConfiguration } from '../../providers/form/api'; import { FormIdentifier } from '../../providers/form/models'; @@ -99,19 +99,22 @@ const QuickView: FC> = ({ } }, [entityId, getEntityUrl, formSettings]); - const formContent = - formSettings && formData ? ( - - ) : ( - <> - ); + const formContent = useMemo(() => { + return formSettings && formData ? ( + + + + ) : ( + <> + ); + }, [formSettings, formData]); const render = () => { if (children) { diff --git a/shesha-reactjs/src/pages/dynamic/index.stories.tsx b/shesha-reactjs/src/pages/dynamic/index.stories.tsx index 1dc8ec91a..b69932288 100644 --- a/shesha-reactjs/src/pages/dynamic/index.stories.tsx +++ b/shesha-reactjs/src/pages/dynamic/index.stories.tsx @@ -43,6 +43,7 @@ export const OrganisationEdit = addStory(Template, { module: 'Test Module', version: 1, }, + id: '5BC9A277-63ED-4A71-919F-0B4064363BBC' }); export const PersonEdit = addStory(Template, { @@ -51,6 +52,7 @@ export const PersonEdit = addStory(Template, { module: 'Test Module', version: 7, }, + id: '32E2B3DD-4D99-4542-AF71-134EC7C0E2CE' }); export const PersonDetails = addStory(Template, {