Merged PR 1295: update logic on breadcrumb

update logic on breadcrumb

Related work items: #12674
This commit is contained in:
Robert Bond
2024-11-20 12:04:39 +00:00
+12 -2
View File
@@ -20,6 +20,7 @@ const Breadcrumbs = (props) => {
setCurrentView, setCurrentView,
setCurrentSection, setCurrentSection,
setRepresentationCapacity, setRepresentationCapacity,
setRepresentationSubmit,
} = props; } = props;
const router = useRouter(); const router = useRouter();
let { t } = useTranslation(); let { t } = useTranslation();
@@ -871,7 +872,12 @@ const Breadcrumbs = (props) => {
className="govuk-breadcrumbs__link" className="govuk-breadcrumbs__link"
href="#" href="#"
onClick={() => { onClick={() => {
setRepresentationCapacity(); props.currentView
.representationSubmit
? setRepresentationSubmit(
false
)
: setRepresentationCapacity();
props.updateField( props.updateField(
"representationForm", "representationForm",
"representationType", "representationType",
@@ -879,7 +885,7 @@ const Breadcrumbs = (props) => {
); );
}} }}
> >
{t("common:back-link")}{" "} {t("common:back-link")}
</a> </a>
</li> </li>
)} )}
@@ -1119,6 +1125,10 @@ const mapDispatchToProps = (dispatch) => {
//dispatch(reset("representationForm")); //dispatch(reset("representationForm"));
dispatch(setRepresentationCapacity(representationCapacity)); dispatch(setRepresentationCapacity(representationCapacity));
}, },
setRepresentationSubmit: (representationSubmit) => {
dispatch(setRepresentationSubmit(representationSubmit));
},
setCurrentView: (currentView) => { setCurrentView: (currentView) => {
dispatch(setCurrentView(currentView)); dispatch(setCurrentView(currentView));
}, },