Skip to content

Commit

Permalink
When opening the registration form properly mark opened section as vi…
Browse files Browse the repository at this point in the history
…sited
  • Loading branch information
samau3 committed Sep 11, 2024
1 parent a82533d commit 30ffd56
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion client/src/pages/patients/PatientRegistration.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,19 @@ export default function PatientRegistration() {
// Opens the section based on the hash in the URL
useEffect(() => {
let section = location.hash.replace('#', '');
if (section === '') section = 'patientData';

if (section === '') {
section = 'patientData';
}

if (section !== 'patientData') {
setVisitedSections((prevVisitedSections) => ({
...prevVisitedSections,
[section]: true,
patientData: false,
}));
}

setOpenedSection(section);
// NOTE: Only want this useEffect to run once on mount to set the opened section
// eslint-disable-next-line
Expand Down

0 comments on commit 30ffd56

Please sign in to comment.