Skip to content
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

fix: Connected on Polkadot, opening Base link on Koda, mint ing - starts loading #10772

Merged
merged 6 commits into from
Aug 12, 2024

Conversation

Jarsen136
Copy link
Contributor

Thank you for your contribution to the Koda - Generative Art Marketplace.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix

Needs QA check

  • @kodadot/qa-guild please review

Context

Did your issue had any of the "$" label on it?

Screenshot 📸

  • My fix has changed something on UI; a screenshot is best to understand changes for others.
image

@Jarsen136 Jarsen136 requested a review from a team as a code owner August 8, 2024 07:50
@Jarsen136 Jarsen136 requested review from preschian and vikiival and removed request for a team August 8, 2024 07:50
Copy link

netlify bot commented Aug 8, 2024

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 7408760
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/66b86ca0c250bd000862c16a
😎 Deploy Preview https://deploy-preview-10772--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@vikiival vikiival requested review from hassnian and removed request for vikiival August 8, 2024 09:59
@vikiival
Copy link
Member

vikiival commented Aug 8, 2024

hassnian
hassnian previously approved these changes Aug 9, 2024
Copy link
Contributor

@hassnian hassnian left a comment

Choose a reason for hiding this comment

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

small, otherwise LGTM

stores/wallet.ts Show resolved Hide resolved
components/collection/drop/PaidGenerative.vue Outdated Show resolved Hide resolved
@hassnian hassnian dismissed their stale review August 9, 2024 05:18

code issue

stores/wallet.ts Outdated Show resolved Hide resolved
components/collection/drop/PaidGenerative.vue Outdated Show resolved Hide resolved
@vikiival vikiival requested a review from hassnian August 9, 2024 09:45
@vikiival
Copy link
Member

vikiival commented Aug 9, 2024

cc @Jarsen136

@Jarsen136
Copy link
Contributor Author

All should have been updated. May I get your code review again? @hassnian

@hassnian
Copy link
Contributor

hassnian commented Aug 9, 2024

All should have been updated. May I get your code review again? @hassnian

Could you do #10772 (comment)

This way 'useDoAfterReconnect' takes at least on success and we can have open 'openReconnectModal' without anything passed like https://github.com/Jarsen136/nft-gallery/blob/issue-10753/composables/useDoAfterlogin.ts

Tyvm

@Jarsen136
Copy link
Contributor Author

All should have been updated. May I get your code review again? @hassnian

Could you do #10772 (comment)

This way 'useDoAfterReconnect' takes at least on success and we can have open 'openReconnectModal' without anything passed like https://github.com/Jarsen136/nft-gallery/blob/issue-10753/composables/useDoAfterlogin.ts

Tyvm

Updated

@hassnian
Copy link
Contributor

hassnian commented Aug 11, 2024

@Jarsen136 did you push your changes ?

CleanShot 2024-08-11 at 12 39 29@2x

related?

CleanShot 2024-08-11 at 12 40 30

@Jarsen136
Copy link
Contributor Author

related?

CleanShot 2024-08-11 at 12 40 30

Yes, there is something wrong on GitHub I guess. Let me try to push another commit.

Copy link

sonarcloud bot commented Aug 11, 2024

@hassnian
Copy link
Contributor

@Jarsen136 dont remove the useReconnectModal use the openreconnectmodal there

@Jarsen136
Copy link
Contributor Author

@Jarsen136 dont remove the useReconnectModal use the openreconnectmodal there

Do you mean like this?

const { openReconnectWalletModal } = useReconnectModal()

I don't get the benefit or major difference of using it as a composable instead of utils function.
Could you explain a bit? In the previous implementation, it was a composable function but with a different name.

@hassnian
Copy link
Contributor

hassnian commented Aug 12, 2024

@Jarsen136 dont remove the useReconnectModal use the openreconnectmodal there

Do you mean like this?

const { openReconnectWalletModal } = useReconnectModal()

I don't get the benefit or major difference of using it as a composable instead of utils function. Could you explain a bit? In the previous implementation, it was a composable function but with a different name.

sure, I was thinking something like this

export default function () {
  const { getWalletVM, getIsWalletVMChain } = storeToRefs(useWalletStore())

  const needsReconnect = computed(() => getWalletVM.value && !getIsWalletVMChain.value) // computed can be removed if it's not needed outside of this composable

  const doAfterReconnect = ({ onSuccess, onCancel }) => {
    if (needsReconnect.value) {
      openReconnectWalletModal({
        onConnect: onSuccess,
        onCancel,
        closeAfterConnect: true,
      })
    }
    else {
      onSuccess()
    }
  }

  return {
    doAfterReconnect,
    needsReconnect
  }
}

this way you can remove getWalletVM.value && !getIsWalletVMChain.value) that was being duplicated

this


  if (getWalletVM.value && !getIsWalletVMChain.value) {
    openReconnectWalletModal()
    return
  }
  emit('mint')

becomes

  useDoAfterReconnect({ onSuccess: () => {
      emit('mint')
  }})

if you need more control you can create and use needsReconnect and openReconnectWalletModal independently

@Jarsen136
Copy link
Contributor Author

@Jarsen136 dont remove the useReconnectModal use the openreconnectmodal there

Do you mean like this?

const { openReconnectWalletModal } = useReconnectModal()

I don't get the benefit or major difference of using it as a composable instead of utils function. Could you explain a bit? In the previous implementation, it was a composable function but with a different name.

sure, I was thinking something like this

export default function () {
  const { getWalletVM, getIsWalletVMChain } = storeToRefs(useWalletStore())

  const needsReconnect = computed(() => getWalletVM.value && !getIsWalletVMChain.value) // computed can be removed if it's not needed outside of this composable

  const doAfterReconnect = ({ onSuccess, onCancel }) => {
    if (needsReconnect.value) {
      openReconnectWalletModal({
        onConnect: onSuccess,
        onCancel,
        closeAfterConnect: true,
      })
    }
    else {
      onSuccess()
    }
  }

  return {
    doAfterReconnect,
    needsReconnect
  }
}

this way you can remove getWalletVM.value && !getIsWalletVMChain.value) that was being duplicated

this


  if (getWalletVM.value && !getIsWalletVMChain.value) {
    openReconnectWalletModal()
    return
  }
  emit('mint')

becomes

  useDoAfterReconnect({ onSuccess: () => {
      emit('mint')
  }})

if you need more control you can create and use needsReconnect and openReconnectWalletModal independently

Now I understand your concern and you would like to reuse the check condition getWalletVM.value && !getIsWalletVMChain.value). However, this check condition is not universal and does not apply to all cases.

// 1. components/carousel/CarouselTypeDrops.vue
It checks if the chain of drop matches the walletVM.
image

// 2. components/collection/drop/MintButton.vue
It checks if the current urlPrefix matches the walletVM.
image

In other words, the logic suitable for reuse is only openReconnectWalletModal. No matter putting it to the composable or utils function, it's fine. wdyt @hassnian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Connected on Polkadot, opening Base link on Koda, minting - starts loading
4 participants