Skip to content

Conversation

@elefantel
Copy link
Contributor

This PR ensures that the dapp updates the consumer of the sdk after it has fetched a cached session on startup

@elefantel elefantel self-assigned this Jul 29, 2024
@elefantel elefantel requested a review from a team as a code owner July 29, 2024 11:18
Copy link
Contributor

@andreahaku andreahaku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@elefantel elefantel merged commit 895604d into main Jul 29, 2024
@elefantel elefantel deleted the sync-dapp-state branch July 29, 2024 13:48
Comment on lines 49 to +53
// Expose plain variables for developers who prefer not using observing live data via ethereumState
val chainId: String
get() = currentEthereumState.chainId
get() = if (currentEthereumState.chainId.isEmpty()) { currentEthereumState.chainId } else { cachedChainId }
val selectedAddress: String
get() = currentEthereumState.selectedAddress
get() = if (currentEthereumState.selectedAddress.isEmpty()) { currentEthereumState.selectedAddress } else { cachedAccount }
Copy link

@zmeytee zmeytee Jul 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allways returns cached or empty.

Maybe:

val chainId: String
        get() = currentEthereumState.chainId.ifEmpty { cachedChainId }
val selectedAddress: String
        get() = currentEthereumState.selectedAddress.ifEmpty { cachedAccount }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants