@overmap-ai/core 1.0.27 → 1.0.29-org-switcher-and-bug-fixes.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4860,14 +4860,18 @@ var __publicField = (obj, key, value) => {
4860
4860
  }
4861
4861
  }
4862
4862
  store.dispatch(setCurrentUser(data.user));
4863
+ store.dispatch(addUsers(data.project_owners));
4863
4864
  const organizationsData = data.organizations;
4864
4865
  store.dispatch(setOrganizations(organizationsData));
4866
+ const activeOrganizationId = store.getState().organizationReducer.activeOrganizationId;
4865
4867
  const firstOrg = organizationsData[0];
4866
4868
  const currProjObj = projects.find((project) => project.id === currentProjectId);
4867
4869
  const isOrgProject = !!(currProjObj == null ? void 0 : currProjObj.owner_organization);
4868
4870
  const userIsInProjectOrg = isOrgProject && organizationsData.some((organization) => organization.id === currProjObj.owner_organization);
4869
4871
  let currentOrgId = null;
4870
- if (userIsInProjectOrg) {
4872
+ if (activeOrganizationId) {
4873
+ currentOrgId = activeOrganizationId;
4874
+ } else if (userIsInProjectOrg) {
4871
4875
  currentOrgId = currProjObj.owner_organization;
4872
4876
  } else if (firstOrg) {
4873
4877
  currentOrgId = firstOrg.id;