Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverts elements from #12169 #12722

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);