Skip to content

Commit

Permalink
Mark the workspace as created after navigating
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-marcellini committed Apr 11, 2022
1 parent 54e91d1 commit 4f594d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/libs/actions/Policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ function create(name = '') {
let res = null;
return API.Policy_Create({type: CONST.POLICY.TYPE.FREE, policyName: name})
.then((response) => {
Onyx.set(ONYXKEYS.IS_CREATING_WORKSPACE, false);
if (response.jsonCode !== 200) {
// Show the user feedback
const errorMessage = Localize.translateLocal('workspace.new.genericFailureMessage');
Expand Down Expand Up @@ -157,7 +156,10 @@ function navigateToPolicy(policyID) {
* @param {String} [name]
*/
function createAndNavigate(name = '') {
create(name).then(navigateToPolicy);
create(name).then(() => {
navigateToPolicy();
Onyx.set(ONYXKEYS.IS_CREATING_WORKSPACE, false);
});
}

/**
Expand Down Expand Up @@ -228,6 +230,7 @@ function createAndGetPolicyList() {
.then(() => {
Navigation.dismissModal();
navigateToPolicy(newPolicyID);
Onyx.set(ONYXKEYS.IS_CREATING_WORKSPACE, false);
});
}

Expand Down Expand Up @@ -506,7 +509,6 @@ export {
removeMembers,
invite,
isAdminOfFreePolicy,
create,
uploadAvatar,
update,
setWorkspaceErrors,
Expand Down

0 comments on commit 4f594d1

Please sign in to comment.