Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

2245/hide claims while loading #2338

Merged
merged 8 commits into from
Jan 28, 2022
Merged

Conversation

alfetopito
Copy link
Contributor

Summary

Closes #2245

Hide claims until loading is finished

For now I'm using a very ugly basic loader
Not in the scope of this PR to make it look nice

To Test

  1. Check for claims in different accounts
  • The claims should only be shown after finished loading

@alfetopito alfetopito self-assigned this Jan 27, 2022
@alfetopito alfetopito requested review from a team January 27, 2022 20:34
type ClaimIntroductionProps = Pick<ClaimCommonTypes, 'hasClaims' | 'handleChangeAccount'> & {
isAirdropOnly: boolean
}
type ClaimIntroductionProps = Pick<ClaimCommonTypes, 'hasClaims' | 'handleChangeAccount' | 'isAirdropOnly'>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Refactored props for a couple of components

Comment on lines +115 to -127
export default function ClaimsTable({ isAirdropOnly, claims, hasClaims }: ClaimsTableProps) {
const { selectedAll, selected, activeClaimAccount, claimStatus, isInvestFlowActive } = useClaimState()

const { setSelectedAll, setSelected } = useClaimDispatchers()

const pendingClaimsSet = useAllClaimingTransactionIndices()

const userClaimData = useUserEnhancedClaimData(activeClaimAccount)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Passing down as props to avoid fetching the same thing in 3 different places and cause additional UI delays

import EligibleBanner from './EligibleBanner'
import FooterNavButtons from './FooterNavButtons'
import InvestmentFlow from './InvestmentFlow'
import { ClaimSummary } from './ClaimSummary'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A lot of noise I know, but the imports were a mess.
Split them by "category"

*
* @param account
*/
export function useUserHasAvailableClaim(account: Account): boolean {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Was not in use

@github-actions
Copy link
Contributor

  • 🔭 GP Swap: CoW Protocol v2 Swap UI

@elena-zh
Copy link

Great!

@alfetopito alfetopito force-pushed the 2245/hide-claims-while-loading branch from 9dc89da to 7e8b7ca Compare January 28, 2022 17:48
@alfetopito alfetopito merged commit 9bc32af into release/1.10 Jan 28, 2022
@alfetopito alfetopito deleted the 2245/hide-claims-while-loading branch January 28, 2022 18:01
alfetopito added a commit that referenced this pull request Jan 28, 2022
* Removed unused hook

* Made claim loading return an isLoading state

* Refactored ClaimsTable and Investment flow

To take claims as parameter to avoid unnecessary hook calls

* Added a very ugly loader to claims page

* Organized a bit claim/index imports mess

* Refactoring claim page components props

* Start hook loading by default

* Show loader inside modal. Still ugly

Co-authored-by: Leandro <[email protected]>
ramirotw pushed a commit that referenced this pull request Feb 18, 2022
* fix: only try SafeApp connection in an iframe

Improves non-iframe pageload by 300ms. Fixes #2338.

The Gnosis check for a SafeApp races a postMessage and a 300ms timeout [1]. The SafeApp embeds the interface in an iframe, so this avoids the check when not in iframes.

[1]: https://github.com/gnosis/safe-apps-sdk/blob/f224869dd5ae810db8cecad08fbbcfaa6c046d9d/packages/safe-apps-web3-react/src/connector.ts#L52

* refactor: IS_IN_IFRAME const
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants