Skip to content

Commit e41142f

Browse files
Merge pull request #143 from mercedes-benz/VULCAN-941/GrayedOutButton
Fix for automatic reset view rups package link
2 parents c83982e + 6060e21 commit e41142f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/chart/table/TableChart.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ export const NeoTableChart = (props: ChartProps) => {
129129
}
130130

131131
const { records } = props;
132+
const isApiSpecEnabled = props.settings?.apiSpec && props.settings?.apiSpec.apiEnabled;
132133

133134
const generateSafeColumnKey = (key) => {
134135
return key != 'id' ? key : `${key} `;
@@ -346,6 +347,12 @@ export const NeoTableChart = (props: ChartProps) => {
346347
props.updateReportSetting('apiSpec', { ...props.settings?.apiSpec, response: null });
347348
};
348349

350+
useEffect(() => {
351+
if (isApiSpecEnabled) {
352+
handleResetApiResponse();
353+
}
354+
}, [records]);
355+
349356
const apiCallButton = () => (
350357
<Stack direction='row' spacing={2} justifyContent='flex-end' marginRight={2}>
351358
<Button variant='outlined' size='small' onClick={handleApiCall} disabled={isApiLoading}>
@@ -361,9 +368,6 @@ export const NeoTableChart = (props: ChartProps) => {
361368
{isApiLoading ? 'Loading...' : props.settings?.viewResponseButtonName || 'view response'}
362369
</Button>
363370
)}
364-
<IconButton clean={true} grouped={true} aria-label={'Reset'} onClick={handleResetApiResponse}>
365-
<ArrowPathIconOutline aria-label={'Reset'} />
366-
</IconButton>
367371
{props.settings?.apiSpec.response ? (
368372
<Popover
369373
id={id}
@@ -391,8 +395,6 @@ export const NeoTableChart = (props: ChartProps) => {
391395
</Stack>
392396
);
393397

394-
const isApiSpecEnabled = props.settings?.apiSpec && props.settings?.apiSpec.apiEnabled;
395-
396398
const tableStyle: any = isApiSpecEnabled
397399
? { marginTop: 10, height: '90%', width: '100%', position: 'relative' }
398400
: { height: '100%', width: '100%', position: 'relative' };

0 commit comments

Comments
 (0)