Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/results/loadflow/load-flow-result-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export const LoadFlowResultTab: FunctionComponent<LoadFlowTabProps> = ({

const result = useMemo(() => {
if (!loadflowResult) {
return [];
return undefined;
}
if (tabIndex === 0 || tabIndex === 1) {
return makeData(loadflowResult, intl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ export const SecurityAnalysisResultN: FunctionComponent<SecurityAnalysisResultNP
const intl: IntlShape = useIntl();

const rows = useMemo(() => {
return result?.length // check if it's not Page object
? (result?.map((preContingencyResult: PreContingencyResult) => {
return !result
? undefined
: (result?.map((preContingencyResult: PreContingencyResult) => {
const { limitViolation, subjectId } = preContingencyResult;
return {
subjectId: subjectId,
Expand All @@ -51,8 +52,7 @@ export const SecurityAnalysisResultN: FunctionComponent<SecurityAnalysisResultNP
? null
: limitViolation?.upcomingAcceptableDuration,
} as SecurityAnalysisNTableRow;
}) ?? [])
: [];
}) ?? []);
}, [intl, result]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export interface SecurityAnalysisNTableRow {
}

export interface SecurityAnalysisResultProps {
rows: SecurityAnalysisNTableRow[] | SecurityAnalysisNmkTableRow[];
rows: SecurityAnalysisNTableRow[] | SecurityAnalysisNmkTableRow[] | undefined;
columnDefs: ColDef[];
isLoadingResult: boolean;
agGridProps?: AgGridReactProps;
Expand Down
4 changes: 2 additions & 2 deletions src/components/utils/aggrid-rows-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export function getNoRowsMessage(
case RunningStatus.FAILED:
return messages.failed;
case RunningStatus.SUCCEED:
if (!isDataReady) {
if (!isDataReady || !rows) {
return messages.fetching;
} else if (!rows || rows?.length === 0) {
} else if (rows && rows.length === 0) {
return messages.noData ? messages.noData : messages.noLimitViolation;
}
return undefined;
Expand Down
Loading