Skip to content

Commit

Permalink
fix: mandatory params on AddressDetail children (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuliomir authored Sep 17, 2024
1 parent ccd2f6e commit 8391ac6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/screens/AddressDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@

import React from 'react';
import { useFlag } from '@unleash/proxy-client-react';
import { useHistory } from 'react-router-dom/cjs/react-router-dom';
import { useParams } from 'react-router-dom';
import AddressDetailExplorer from '../components/AddressDetailExplorer';
import AddressDetailLegacy from '../components/AddressDetailLegacy';
import { UNLEASH_ADDRESS_DETAIL_BASE_FEATURE_FLAG } from '../constants';
import ErrorMessageWithIcon from '../components/error/ErrorMessageWithIcon';

const AddressDetail = props => {
const AddressDetail = () => {
const maintenanceMode = useFlag(`${UNLEASH_ADDRESS_DETAIL_BASE_FEATURE_FLAG}.maintenance`);
const latestMode = useFlag(`${UNLEASH_ADDRESS_DETAIL_BASE_FEATURE_FLAG}.latest`);
const history = useHistory();
const params = useParams();

if (maintenanceMode) {
return (
Expand All @@ -23,10 +27,10 @@ const AddressDetail = props => {
}

if (latestMode) {
return <AddressDetailExplorer {...props} />;
return <AddressDetailExplorer history={history} match={{ params }} />;
}

return <AddressDetailLegacy {...props} />;
return <AddressDetailLegacy history={history} match={{ params }} />;
};

export default AddressDetail;

0 comments on commit 8391ac6

Please sign in to comment.