Skip to content

Commit

Permalink
Merge pull request #180 from TelemetryDeck/fix-user-stuck-in-loading
Browse files Browse the repository at this point in the history
Add FunctionCall to finish Loading
  • Loading branch information
Black-Fox-2022 authored May 24, 2024
2 parents fdee6a4 + 18abe55 commit ce1fbd3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Services/OrgService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class OrgService: ObservableObject {
self.errorService = errors
}

// Wasn't getting called before -> Never leaving loading state.
// For now called when retrieveOrganisations also called
// Maybe move getCode into the retrieve Func?
func getOrganisation() {
let locallyCachedOrganization = retrieveFromDisk()
self.organization = locallyCachedOrganization
Expand All @@ -33,7 +36,6 @@ class OrgService: ObservableObject {
let org = try await self.retrieveOrganisation()
DispatchQueue.main.async {
self.organization = org

self.loadingState = .finished(Date())
}
} catch {
Expand Down
1 change: 1 addition & 0 deletions Shared/Navigational Structure/LeftSidebarView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ struct LeftSidebarView: View {
if let organization = try? await orgService.retrieveOrganisation() {
DispatchQueue.main.async {
orgService.organization = organization
orgService.getOrganisation()
}
}
}
Expand Down

0 comments on commit ce1fbd3

Please sign in to comment.