Skip to content

Commit

Permalink
Merge pull request #32327 from DylanDylann/fix/32302-private-notes-ed…
Browse files Browse the repository at this point in the history
…iter-open

Fix/32302: Note editor open
  • Loading branch information
techievivek authored Dec 1, 2023
2 parents a1815b3 + 5ef4b79 commit 3208c62
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/pages/ReportDetailsPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import PropTypes from 'prop-types';
import React, {useMemo} from 'react';
import React, {useEffect, useMemo} from 'react';
import {ScrollView, View} from 'react-native';
import {withOnyx} from 'react-native-onyx';
import _ from 'underscore';
Expand All @@ -9,6 +9,7 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Expensicons from '@components/Icon/Expensicons';
import MenuItem from '@components/MenuItem';
import MultipleAvatars from '@components/MultipleAvatars';
import {withNetwork} from '@components/OnyxProvider';
import ParentNavigationSubtitle from '@components/ParentNavigationSubtitle';
import participantPropTypes from '@components/participantPropTypes';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
Expand Down Expand Up @@ -76,6 +77,17 @@ function ReportDetailsPage(props) {

const isGroupDMChat = useMemo(() => ReportUtils.isDM(props.report) && participants.length > 1, [props.report, participants.length]);

const isPrivateNotesFetchTriggered = !_.isUndefined(props.report.isLoadingPrivateNotes);

useEffect(() => {
// Do not fetch private notes if isLoadingPrivateNotes is already defined, or if network is offline.
if (isPrivateNotesFetchTriggered || props.network.isOffline) {
return;
}

Report.getReportPrivateNote(props.report.reportID);
}, [props.report.reportID, props.network.isOffline, isPrivateNotesFetchTriggered]);

const menuItems = useMemo(() => {
const items = [];

Expand Down Expand Up @@ -249,6 +261,7 @@ ReportDetailsPage.defaultProps = defaultProps;
export default compose(
withLocalize,
withReportOrNotFound(),
withNetwork(),
withOnyx({
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
Expand Down

0 comments on commit 3208c62

Please sign in to comment.