Skip to content

Commit

Permalink
Renamed withReportOrNavigateHome to withReportOrNotFound
Browse files Browse the repository at this point in the history
  • Loading branch information
s77rt committed Feb 24, 2023
1 parent 9651220 commit 15bcf15
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import MenuItem from '../components/MenuItem';
import Text from '../components/Text';
import CONST from '../CONST';
import reportPropTypes from './reportPropTypes';
import withReportOrNavigateHome from './home/report/withReportOrNavigateHome';
import withReportOrNotFound from './home/report/withReportOrNotFound';
import FullPageNotFoundView from '../components/BlockingViews/FullPageNotFoundView';

const propTypes = {
Expand Down Expand Up @@ -181,7 +181,7 @@ ReportDetailsPage.propTypes = propTypes;

export default compose(
withLocalize,
withReportOrNavigateHome,
withReportOrNotFound,
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReportParticipantsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import withLocalize, {withLocalizePropTypes} from '../components/withLocalize';
import compose from '../libs/compose';
import * as ReportUtils from '../libs/ReportUtils';
import reportPropTypes from './reportPropTypes';
import withReportOrNavigateHome from './home/report/withReportOrNavigateHome';
import withReportOrNotFound from './home/report/withReportOrNotFound';
import FullPageNotFoundView from '../components/BlockingViews/FullPageNotFoundView';

const propTypes = {
Expand Down Expand Up @@ -118,7 +118,7 @@ ReportParticipantsPage.displayName = 'ReportParticipantsPage';

export default compose(
withLocalize,
withReportOrNavigateHome,
withReportOrNotFound,
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS,
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ReportSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import Picker from '../components/Picker';
import * as ValidationUtils from '../libs/ValidationUtils';
import OfflineWithFeedback from '../components/OfflineWithFeedback';
import reportPropTypes from './reportPropTypes';
import withReportOrNavigateHome from './home/report/withReportOrNavigateHome';
import withReportOrNotFound from './home/report/withReportOrNotFound';
import Form from '../components/Form';
import FullPageNotFoundView from '../components/BlockingViews/FullPageNotFoundView';

Expand Down Expand Up @@ -220,7 +220,7 @@ ReportSettingsPage.propTypes = propTypes;

export default compose(
withLocalize,
withReportOrNavigateHome,
withReportOrNotFound,
withOnyx({
policies: {
key: ONYXKEYS.COLLECTION.POLICY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function (WrappedComponent) {
report: {},
};

class WithReportOrNavigateHome extends Component {
class WithReportOrNotFound extends Component {
render() {
if (_.isEmpty(this.props.report) || !this.props.report.reportID) {
return <NotFoundPage />;
Expand All @@ -40,17 +40,18 @@ export default function (WrappedComponent) {
}
}

WithReportOrNavigateHome.propTypes = propTypes;
WithReportOrNavigateHome.defaultProps = defaultProps;
WithReportOrNavigateHome.displayName = `withReportOrNavigateHome(${getComponentDisplayName(WrappedComponent)})`;
const withReportOrNavigateHome = React.forwardRef((props, ref) => (
WithReportOrNotFound.propTypes = propTypes;
WithReportOrNotFound.defaultProps = defaultProps;
WithReportOrNotFound.displayName = `withReportOrNotFound(${getComponentDisplayName(WrappedComponent)})`;
// eslint-disable-next-line rulesdir/no-negated-variables
const withReportOrNotFound = React.forwardRef((props, ref) => (
// eslint-disable-next-line react/jsx-props-no-spreading
<WithReportOrNavigateHome {...props} forwardedRef={ref} />
<WithReportOrNotFound {...props} forwardedRef={ref} />
));

return withOnyx({
report: {
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${route.params.reportID}`,
},
})(withReportOrNavigateHome);
})(withReportOrNotFound);
}

0 comments on commit 15bcf15

Please sign in to comment.