diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e2bb8f4a..ae4368bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [100.8.4](https://github.com/dhis2/data-visualizer-app/compare/v100.8.3...v100.8.4) (2024-11-07) + + +### Bug Fixes + +* infinite spinner when opening the interpretations modal while viewing a visualization ([#3283](https://github.com/dhis2/data-visualizer-app/issues/3283)) ([403adbc](https://github.com/dhis2/data-visualizer-app/commit/403adbc45f3d0f7983317eae4a6ccd44f970c428)) + ## [100.8.3](https://github.com/dhis2/data-visualizer-app/compare/v100.8.2...v100.8.3) (2024-10-24) diff --git a/cypress/integration/interpretations.cy.js b/cypress/integration/interpretations.cy.js new file mode 100644 index 000000000..c710a3d4a --- /dev/null +++ b/cypress/integration/interpretations.cy.js @@ -0,0 +1,41 @@ +import { VIS_TYPE_BAR } from '@dhis2/analytics' +import { + expectAOTitleToBeValue, + expectVisualizationToBeVisible, +} from '../elements/chart.js' +import { openAOByName } from '../elements/fileMenu/index.js' +import { goToStartPage } from '../elements/startScreen.js' + +describe('Interpretations', () => { + it('opens the interpretations modal on a saved AO', () => { + const ao = { + name: 'ANC: 1 and 3 coverage Yearly', + type: VIS_TYPE_BAR, + } + + // Open the saved AO + goToStartPage() + openAOByName(ao.name) + expectAOTitleToBeValue(ao.name) + expectVisualizationToBeVisible(ao.type) + + // Open the interpretations panel + cy.getBySel('dhis2-analytics-interpretationsanddetailstoggler').click() + + cy.getBySel('interpretations-list') + .find('button') + .contains('See interpretation') + .click() + + cy.getBySel('interpretation-modal').should('be.visible') + + cy.get('.highcharts-container').should('be.visible') + + cy.getBySel('interpretation-modal') + .find('button') + .contains('Hide interpretation') + .click() + + cy.getBySel('interpretation-modal').should('not.exist') + }) +}) diff --git a/package.json b/package.json index 67e359b6e..0d3fc8dd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "data-visualizer-app", - "version": "100.8.3", + "version": "100.8.4", "description": "DHIS2 Data Visualizer", "license": "BSD-3-Clause", "private": true, diff --git a/src/components/VisualizationPlugin/VisualizationPluginWrapper.js b/src/components/VisualizationPlugin/VisualizationPluginWrapper.js index 18a1e4157..ebf9b269a 100644 --- a/src/components/VisualizationPlugin/VisualizationPluginWrapper.js +++ b/src/components/VisualizationPlugin/VisualizationPluginWrapper.js @@ -67,23 +67,28 @@ const VisualizationPluginWrapper = (props) => { const onLoadingComplete = () => setIsLoading(false) - const onResponsesReceived = useCallback( + const { visualization, onResponsesReceived } = props + const handleResponsesReceived = useCallback( (responses) => { try { ensureAnalyticsResponsesContainData( responses, - props.visualization.type + visualization.type ) } catch (error) { setError(error) } + + typeof onResponsesReceived === 'function' && + onResponsesReceived(responses) }, - [props.visualization.type] + [visualization.type, onResponsesReceived] ) if (error) { return } + return ( <> {isLoading && ( @@ -97,7 +102,7 @@ const VisualizationPluginWrapper = (props) => { {...pluginProps} onDataSorted={onDataSorted} onLoadingComplete={onLoadingComplete} - onResponsesReceived={onResponsesReceived} + onResponsesReceived={handleResponsesReceived} /> )