Skip to content

Commit

Permalink
Merge pull request #12722 from Expensify/marcaaron-revertWaitForRepor…
Browse files Browse the repository at this point in the history
…tActions

Reverts elements from #12169

(cherry picked from commit c85be58)
  • Loading branch information
mountiny authored and OSBotify committed Nov 15, 2022
1 parent 103b20d commit 497f3d7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 46 deletions.
3 changes: 0 additions & 3 deletions src/ONYXKEYS.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,6 @@ export default {
// Is report data loading?
IS_LOADING_REPORT_DATA: 'isLoadingReportData',

// Are we loading the initial app data?
IS_LOADING_INITIAL_APP_DATA: 'isLoadingInitialAppData',

// Is Keyboard shortcuts modal open?
IS_SHORTCUTS_MODAL_OPEN: 'isShortcutsModalOpen',

Expand Down
15 changes: 0 additions & 15 deletions src/libs/actions/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,35 +123,20 @@ function openApp() {
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: true,
},
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_INITIAL_APP_DATA,
value: true,
},
],
successData: [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: false,
},
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_INITIAL_APP_DATA,
value: false,
},
],
failureData: [
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_REPORT_DATA,
value: false,
},
{
onyxMethod: CONST.ONYX.METHOD.MERGE,
key: ONYXKEYS.IS_LOADING_INITIAL_APP_DATA,
value: false,
},
],
});
}
Expand Down
49 changes: 21 additions & 28 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,9 @@ class ReportScreen extends React.Component {
isReportReadyForDisplay() {
const reportIDFromPath = getReportID(this.props.route);

// We need to wait for the initial app data to load as it tells us which reports are unread. Waiting will allow the new marker to be set
// correctly when the report mounts. If we don't do this, the report may initialize in the "read" state and the marker won't be set at all.
const isLoadingInitialAppData = this.props.isLoadingInitialAppData;

// This is necessary so that when we are retrieving the next report data from Onyx the ReportActionsView will remount completely
const isTransitioning = this.props.report && this.props.report.reportID !== reportIDFromPath;
return reportIDFromPath && this.props.report.reportID && !isTransitioning && !isLoadingInitialAppData;
return reportIDFromPath && this.props.report.reportID && !isTransitioning;
}

fetchReportIfNeeded() {
Expand Down Expand Up @@ -283,15 +279,26 @@ class ReportScreen extends React.Component {
this.setState({skeletonViewContainerHeight});
}}
>
{this.isReportReadyForDisplay() && (
<ReportActionsView
reportActions={this.props.reportActions}
report={this.props.report}
session={this.props.session}
isComposerFullSize={this.props.isComposerFullSize}
isDrawerOpen={this.props.isDrawerOpen}
parentViewHeight={this.state.skeletonViewContainerHeight}
/>
{(this.isReportReadyForDisplay() && !isLoadingInitialReportActions) && (
<>
<ReportActionsView
reportActions={this.props.reportActions}
report={this.props.report}
session={this.props.session}
isComposerFullSize={this.props.isComposerFullSize}
isDrawerOpen={this.props.isDrawerOpen}
parentViewHeight={this.state.skeletonViewContainerHeight}
/>
<ReportFooter
errors={addWorkspaceRoomOrChatErrors}
pendingAction={addWorkspaceRoomOrChatPendingAction}
isOffline={this.props.network.isOffline}
reportActions={this.props.reportActions}
report={this.props.report}
isComposerFullSize={this.props.isComposerFullSize}
onSubmitComment={this.onSubmitComment}
/>
</>
)}

{/* Note: The report should be allowed to mount even if the initial report actions are not loaded. If we prevent rendering the report while they are loading then
Expand All @@ -301,17 +308,6 @@ class ReportScreen extends React.Component {
containerHeight={this.state.skeletonViewContainerHeight}
/>
)}
{this.isReportReadyForDisplay() && !isLoadingInitialReportActions && (
<ReportFooter
errors={addWorkspaceRoomOrChatErrors}
pendingAction={addWorkspaceRoomOrChatPendingAction}
isOffline={this.props.network.isOffline}
reportActions={this.props.reportActions}
report={this.props.report}
isComposerFullSize={this.props.isComposerFullSize}
onSubmitComment={this.onSubmitComment}
/>
)}
</View>
</FullPageNotFoundView>
</ScreenWrapper>
Expand Down Expand Up @@ -357,8 +353,5 @@ export default compose(
personalDetails: {
key: ONYXKEYS.PERSONAL_DETAILS,
},
isLoadingInitialAppData: {
key: ONYXKEYS.IS_LOADING_INITIAL_APP_DATA,
},
}),
)(ReportScreen);

0 comments on commit 497f3d7

Please sign in to comment.