Skip to content

Commit a929f89

Browse files
authored
fix: add fallback OrgsState for getAllOrgs (#4590)
1 parent d923e23 commit a929f89

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/resources/selectors/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,10 @@ export const getLabels = (state: AppState, labelIDs: string[]): Label[] => {
7474
export const getAllTokensResources = (state: AppState): PermissionTypes[] =>
7575
get(state, 'resources.tokens.allResources', []) || []
7676

77-
export const getAllOrgs = (state: AppState): OrgsState =>
78-
get(state, 'resources.orgs', {}) || {}
77+
export const getAllOrgs = (state: AppState): OrgsState => {
78+
const errorOrgsState = {
79+
status: RemoteDataState.Error,
80+
org: {id: ''},
81+
}
82+
return get(state, 'resources.orgs', errorOrgsState)
83+
}

src/shared/containers/GetOrganizations.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const GetOrganizations: FunctionComponent = () => {
7676
accountType: account_type,
7777
accountCreatedAt: account_created_at = '',
7878
} = quartzMe
79-
const {id: orgId = ''} = org
79+
const orgId = org?.id ?? ''
8080
window.dataLayer = window.dataLayer ?? []
8181
window.dataLayer.push({
8282
identity: {

0 commit comments

Comments
 (0)