Skip to content

Commit 73a1e00

Browse files
Merge pull request #87175 from allgandalf/fix-tax-detail-rhn-fallback-redirect
Navigate back to taxes list when tax detail RHN can't find tax
2 parents a67a057 + 17b583e commit 73a1e00

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/pages/workspace/taxes/WorkspaceEditTaxPage.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ function WorkspaceEditTaxPage({
5858
Navigation.setParams({taxID: currentTaxID});
5959
}, [taxID, currentTaxID]);
6060

61+
useEffect(() => {
62+
if (currentTaxRate || !policy?.taxRates?.taxes) {
63+
return;
64+
}
65+
Navigation.goBack(ROUTES.WORKSPACE_TAXES.getRoute(policyID));
66+
}, [currentTaxRate, policy?.taxRates?.taxes, policyID]);
67+
6168
const deleteTaxRate = () => {
6269
if (!policyID) {
6370
return;
@@ -67,6 +74,9 @@ function WorkspaceEditTaxPage({
6774
};
6875

6976
if (!currentTaxRate) {
77+
if (policy?.taxRates?.taxes) {
78+
return null;
79+
}
7080
return <NotFoundPage />;
7181
}
7282
const taxCodeToShow = isControlPolicy(policy) ? taxID : '';

0 commit comments

Comments
 (0)