Skip to content

Commit 22d8dc1

Browse files
committed
fix(SA, SE, CC): from review add appTabIndex trigger to reset export CSV button status
fix(SE): Add `sortConfig` trigger to reset export CSV button status, for other computation types results are invalidated when sorting then the button is disabled and trigger a status reset. Signed-off-by: sBouzols <[email protected]>
1 parent a4dcdb8 commit 22d8dc1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/components/results/securityanalysis/security-analysis-export-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ export const SecurityAnalysisExportButton: FunctionComponent<SecurityAnalysisExp
3434
const [isCsvExportLoading, setIsCsvExportLoading] = useState(false);
3535
const [isCsvExportSuccessful, setIsCsvExportSuccessful] = useState(false);
3636
const language = useSelector((state: AppState) => state[PARAM_LANGUAGE]);
37+
const appTabIndex = useSelector((state: AppState) => state.appTabIndex);
3738

3839
const intl = useIntl();
3940

4041
useEffect(() => {
4142
setIsCsvExportSuccessful(false);
42-
}, [studyUuid, nodeUuid, rootNetworkUuid, resultType]);
43+
}, [studyUuid, nodeUuid, rootNetworkUuid, resultType, appTabIndex]);
4344

4445
useEffect(() => {
4546
if (disabled) {

src/components/results/sensitivity-analysis/sensitivity-analysis-export-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ export const SensitivityExportButton: FunctionComponent<SensitivityExportButtonP
5656
const [isCsvExportSuccessful, setIsCsvExportSuccessful] = useState(false);
5757

5858
const language = useSelector((state: AppState) => state[PARAM_LANGUAGE]);
59+
const appTabIndex = useSelector((state: AppState) => state.appTabIndex);
5960
const { filters } = useFilterSelector(AgGridFilterType.SensitivityAnalysis, mappingTabs(sensiKind, nOrNkIndex));
6061
const sortConfig = useSelector(
6162
(state: AppState) => state.tableSort[SENSITIVITY_ANALYSIS_RESULT_SORT_STORE][mappingTabs(sensiKind, nOrNkIndex)]
6263
);
6364

6465
useEffect(() => {
6566
setIsCsvExportSuccessful(false);
66-
}, [studyUuid, currentRootNetworkUuid, nodeUuid, nOrNkIndex, sensiKind, globalFilters]);
67+
}, [studyUuid, currentRootNetworkUuid, nodeUuid, nOrNkIndex, sensiKind, globalFilters, sortConfig, appTabIndex]);
6768

6869
useEffect(() => {
6970
if (disabled) {

src/components/results/shortcircuit/shortcircuit-analysis-export-button.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ export const ShortCircuitExportButton: FunctionComponent<ShortCircuitExportButto
3535

3636
const intl = useIntl();
3737
const language = useSelector((state: AppState) => state[PARAM_LANGUAGE]);
38+
const appTabIndex = useSelector((state: AppState) => state.appTabIndex);
3839

3940
useEffect(() => {
4041
setIsCsvExportSuccessful(false);
41-
}, [studyUuid, currentRootNetworkUuid, nodeUuid, analysisType]);
42+
}, [studyUuid, currentRootNetworkUuid, nodeUuid, analysisType, appTabIndex]);
4243

4344
useEffect(() => {
4445
if (disabled) {

0 commit comments

Comments
 (0)