CE-938: updated 'flashing' occurring in child widget whenever any form fields are changed, instead of only the data in the widget

This commit is contained in:
Tim Chamberlain
2024-05-22 12:38:16 -05:00
parent f44ba8d6d3
commit 1d24b9b40c

View File

@ -119,6 +119,7 @@ function EntityForm(props: Props): JSX.Element
const [, forceUpdate] = useReducer((x) => x + 1, 0); const [, forceUpdate] = useReducer((x) => x + 1, 0);
const [showEditChildForm, setShowEditChildForm] = useState(null as any); const [showEditChildForm, setShowEditChildForm] = useState(null as any);
const [modalDataChangedCounter, setModalDataChangedCount] = useState(0);
const [notAllowedError, setNotAllowedError] = useState(null as string); const [notAllowedError, setNotAllowedError] = useState(null as string);
@ -282,6 +283,8 @@ function EntityForm(props: Props): JSX.Element
setRenderedWidgetSections(newRenderedWidgetSections); setRenderedWidgetSections(newRenderedWidgetSections);
forceUpdate(); forceUpdate();
setModalDataChangedCount(modalDataChangedCounter + 1);
setShowEditChildForm(null); setShowEditChildForm(null);
} }
@ -375,7 +378,7 @@ function EntityForm(props: Props): JSX.Element
widgetMetaData.showExportButton = false; widgetMetaData.showExportButton = false;
return <RecordGridWidget return <RecordGridWidget
key={new Date().getTime()} // added so that editing values actually re-renders... key={`${formValues["tableName"]}-${modalDataChangedCounter}`}
widgetMetaData={widgetMetaData} widgetMetaData={widgetMetaData}
data={widgetData} data={widgetData}
disableRowClick disableRowClick
@ -389,6 +392,10 @@ function EntityForm(props: Props): JSX.Element
if (widgetMetaData.type == "reportSetup") if (widgetMetaData.type == "reportSetup")
{ {
/////////////////////////////////////////////////////////////////////////////////////////////////////////
// if the widget metadata specifies a table name, set form values to that so widget knows which to use //
// (for the case when it is not being specified by a separate field in the record) //
/////////////////////////////////////////////////////////////////////////////////////////////////////////
if (widgetMetaData?.defaultValues?.has("tableName")) if (widgetMetaData?.defaultValues?.has("tableName"))
{ {
formValues["tableName"] = widgetMetaData?.defaultValues.get("tableName"); formValues["tableName"] = widgetMetaData?.defaultValues.get("tableName");