diff --git a/CHANGELOG.md b/CHANGELOG.md index ddcfc2c8a2..7e6fc6a44c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [100.41.3](https://github.com/dhis2/capture-app/compare/v100.41.2...v100.41.3) (2023-10-16) + + +### Bug Fixes + +* [DHIS2-15782] navigation with program stage filter ([#3431](https://github.com/dhis2/capture-app/issues/3431)) ([8f7a017](https://github.com/dhis2/capture-app/commit/8f7a017c5860104620c6b7fc8c20916b00037302)) + ## [100.41.2](https://github.com/dhis2/capture-app/compare/v100.41.1...v100.41.2) (2023-10-12) diff --git a/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser.feature b/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser.feature index d3f07adfe2..b0bdfef1e0 100644 --- a/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser.feature +++ b/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser.feature @@ -186,6 +186,13 @@ And you select the events scheduled today And you apply the current filter Then you see the selected option in the scheduledAt filter +@v>=39 +Scenario: The program stage working list configureation is kept when navigating +Given you open the main page with Ngelehun and WHO RMNCH Tracker context and configure a program stage working list +When you open an enrollment event from the working list +And you go back using the browser button +Then the program stage working list is loaded + @v>=40 Scenario: The user creates, updates and deletes a Program stage custom working list Given you open the main page with Ngelehun and Malaria case diagnosis and Household investigation context diff --git a/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser/index.js b/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser/index.js index 7e5825c8a1..760319bfba 100644 --- a/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser/index.js +++ b/cypress/integration/WorkingLists/TeiWorkingLists/TeiWorkingListsUser/index.js @@ -760,3 +760,42 @@ Then('the program stage custom working list filters are loaded', () => { .should('have.length', 2); }); +Given('you open the main page with Ngelehun and WHO RMNCH Tracker context and configure a program stage working list', () => { + cy.visit('#/?programId=WSGAb5XwJ3Y&orgUnitId=DiszpKrYNg8'); + cy.get('[data-test="template-selector-create-list"]') + .click(); + + cy.get('[data-test="tei-working-lists"]') + .within(() => { + cy.contains('More filters') + .click(); + cy.contains('Program stage') + .click(); + }); + + cy.get('[data-test="list-view-filter-contents"]') + .contains('Postpartum care visit') + .click(); + + cy.get('[data-test="list-view-filter-apply-button"]') + .click(); +}); + +When('you open an enrollment event from the working list', () => { + cy.contains('Linda') + .click(); +}); + +When('you go back using the browser button', () => { + cy.go('back'); +}); + +Then('the program stage working list is loaded', () => { + cy.get('[data-test="tei-working-lists"]') + .find('[data-test="more-filters"]') + .should('have.length', 2); + + cy.get('[data-test="tei-working-lists"]') + .contains('WHOMCH Hemoglobin value') + .should('exist'); +}); diff --git a/package.json b/package.json index 64230da5bf..08fc321e76 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "capture-app", "homepage": ".", - "version": "100.41.2", + "version": "100.41.3", "cacheVersion": "6", "serverVersion": "38", "license": "BSD-3-Clause", @@ -10,7 +10,7 @@ "packages/rules-engine" ], "dependencies": { - "@dhis2/rules-engine-javascript": "100.41.2", + "@dhis2/rules-engine-javascript": "100.41.3", "@dhis2/app-runtime": "^3.9.3", "@dhis2/d2-i18n": "^1.1.0", "@dhis2/d2-icons": "^1.0.1", diff --git a/packages/rules-engine/package.json b/packages/rules-engine/package.json index 88cc2da714..2280715107 100644 --- a/packages/rules-engine/package.json +++ b/packages/rules-engine/package.json @@ -1,6 +1,6 @@ { "name": "@dhis2/rules-engine-javascript", - "version": "100.41.2", + "version": "100.41.3", "license": "BSD-3-Clause", "main": "./build/cjs/index.js", "scripts": { diff --git a/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/ReduxProvider/TeiWorkingListsReduxProvider.container.js b/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/ReduxProvider/TeiWorkingListsReduxProvider.container.js index 1017f47dcd..b0fed150a7 100644 --- a/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/ReduxProvider/TeiWorkingListsReduxProvider.container.js +++ b/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/ReduxProvider/TeiWorkingListsReduxProvider.container.js @@ -38,6 +38,8 @@ export const TeiWorkingListsReduxProvider = ({ onDeleteTemplate, onUpdateDefaultTemplate, programStage, + currentTemplateId, + viewPreloaded, ...commonStateManagementProps } = useWorkingListsCommonStateManagement(storeId, TEI_WORKING_LISTS_TYPE, program); const dispatch = useDispatch(); @@ -47,9 +49,15 @@ export const TeiWorkingListsReduxProvider = ({ }, [dispatch, programId, storeId, selectedTemplateId]); useEffect(() => { - selectedTemplateId && onSelectTemplate && onSelectTemplate(selectedTemplateId); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); + // This hook should only fire when you navigate from the search page to the main page with a working list selected + if (selectedTemplateId && + selectedTemplateId !== currentTemplateId && + !viewPreloaded && + onSelectTemplate + ) { + onSelectTemplate(selectedTemplateId); + } + }, [selectedTemplateId, viewPreloaded, currentTemplateId, onSelectTemplate]); const onSelectListRow = useCallback(({ id }) => { const record = records[id]; @@ -92,6 +100,8 @@ export const TeiWorkingListsReduxProvider = ({ return (