Skip to content
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
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001011701
versionName "1.1.17-1"
versionCode 1001011702
versionName "1.1.17-2"
}
splits {
abi {
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.1.17.1</string>
<string>1.1.17.2</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.1.17.1</string>
<string>1.1.17.2</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "1.1.17-1",
"version": "1.1.17-2",
"author": "Expensify, Inc.",
"homepage": "https://new.expensify.com",
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",
Expand Down
22 changes: 19 additions & 3 deletions src/pages/workspace/withFullPolicy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import _ from 'underscore';
import lodashGet from 'lodash/get';
import React from 'react';
import PropTypes from 'prop-types';
import Str from 'expensify-common/lib/str';
import {withOnyx} from 'react-native-onyx';
import {useNavigationState} from '@react-navigation/native';
import CONST from '../../CONST';
import getComponentDisplayName from '../../libs/getComponentDisplayName';
import * as Policy from '../../libs/actions/Policy';
import ONYXKEYS from '../../ONYXKEYS';

let previousRoute = '';
let previousRouteName = '';
let previousRoutePolicyID = '';

/**
* @param {Object} route
Expand All @@ -19,6 +21,19 @@ function getPolicyIDFromRoute(route) {
return lodashGet(route, 'params.policyID', '');
}

/**
* @param {String} routeName
* @param {String} policyID
* @returns {Boolean}
*/
function isPreviousRouteInSameWorkspace(routeName, policyID) {
return (
Str.startsWith(routeName, 'Workspace')
&& Str.startsWith(previousRouteName, 'Workspace')
&& policyID === previousRoutePolicyID
);
}

const fullPolicyPropTypes = {
/** The full policy object for the current route (as opposed to the policy summary object) */
policy: PropTypes.shape({
Expand Down Expand Up @@ -74,11 +89,12 @@ export default function (WrappedComponent) {
const currentRoute = _.last(useNavigationState(state => state.routes || []));
const policyID = getPolicyIDFromRoute(currentRoute);

if (_.isString(policyID) && !previousRoute.includes(policyID)) {
if (_.isString(policyID) && !_.isEmpty(policyID) && !isPreviousRouteInSameWorkspace(currentRoute.name, policyID)) {
Policy.loadFullPolicy(policyID);
}

previousRoute = lodashGet(currentRoute, 'path', '');
previousRouteName = currentRoute.name;
previousRoutePolicyID = policyID;

const rest = _.omit(props, ['forwardedRef', 'policy']);
return (
Expand Down