-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove the usage of crashing initialiser of IdentifiedArray #1077
Conversation
@@ -16,21 +16,21 @@ final class GatewaySettingsFeatureTests: TestCase { | |||
|
|||
func test_whenViewAppeared_thenCurrentGatewayAndGatewayListIsLoaded() async throws { | |||
// given | |||
let otherGateways: [Radix.Gateway] = [.stokenet, .rcnet] | |||
let otherGateways: [Radix.Gateway] = [.stokenet, .rcnet].asIdentifiable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use validating
instead, which is throwing, and we are in a throwing context
@@ -79,16 +79,16 @@ final class GatewaySettingsFeatureTests: TestCase { | |||
func test_whenNonCurrentGatewayRemovalIsConfirmed_removeGateway() async throws { | |||
// given | |||
let gatewayToBeDeleted = GatewayRow.State(gateway: .rcnet, isSelected: false, canBeDeleted: true) | |||
let otherGateways: [Radix.Gateway] = [.stokenet, .rcnet] | |||
let otherGateways: [Radix.Gateway] = [.stokenet, .rcnet].asIdentifiable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use validating
@@ -141,7 +141,7 @@ public struct PersonasCoordinator: Sendable, FeatureReducer { | |||
return .run { send in | |||
let dApps = try await authorizedDappsClient.getDappsAuthorizedByPersona(persona.id) | |||
.map(PersonaDetails.State.DappInfo.init) | |||
let personaDetailsState = PersonaDetails.State(.general(persona, dApps: .init(uniqueElements: dApps))) | |||
let personaDetailsState = PersonaDetails.State(.general(persona, dApps: dApps.asIdentifiable())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should maybe use validating
here, since it is a throwing context, and we wanna find those bugs...
@@ -74,7 +74,7 @@ public struct PersonaList: Sendable, FeatureReducer { | |||
guard result.count == ids.count else { | |||
throw UpdatePersonaError.personasMissingFromClient(ids.subtracting(result.map(\.id))) | |||
} | |||
await send(.internal(.personasLoaded(.init(uniqueElements: result)))) | |||
await send(.internal(.personasLoaded(result.asIdentifiable()))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validating
instead I think
@@ -286,7 +286,7 @@ public struct PersonaDetails: Sendable, FeatureReducer { | |||
let dApps = try await authorizedDappsClient.getDappsAuthorizedByPersona(oldPersona.id) | |||
.map(State.DappInfo.init) | |||
|
|||
return await .general(persona, dApps: addingDappMetadata(to: .init(uniqueElements: dApps))) | |||
return await .general(persona, dApps: addingDappMetadata(to: dApps.asIdentifiable())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe validating
here too
@@ -266,7 +266,7 @@ struct DappInteractionFlow: Sendable, FeatureReducer { | |||
setAccountsResponse( | |||
to: ongoingAccountsWithoutProofOfOwnership.requestItem, | |||
accessKind: .ongoing, | |||
chosenAccounts: .withoutProofOfOwnership(.init(uniqueElements: ongoingAccountsWithoutProofOfOwnership.accounts)), | |||
chosenAccounts: .withoutProofOfOwnership(ongoingAccountsWithoutProofOfOwnership.accounts.asIdentifiable()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe validating
here ? if we can throw, not sure.
lastLogin: persona == lastLoggedInPersona ? authorizedPersonaSimple?.lastLogin : nil | ||
) | ||
} | ||
.asIdentifiable() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validating
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Jira ticket: https://radixdlt.atlassian.net/browse/ABW-3148
Description
We have several crash reports relating to transaction that did contain proofs, and a problems seem to be having multiple identical proofs which caused the app to crash:
The problem was the usage of the crashing initialiser of IdentifiedArray. I went a bit overboard and replaced all these usages with safe
asIdentifiable
.