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

feat: Use subscription to track changes in Gallery Item #4633

Merged
merged 6 commits into from
Jan 11, 2023

Conversation

Jarsen136
Copy link
Contributor

@Jarsen136 Jarsen136 commented Jan 7, 2023

Thank you for your contribution to the KodaDot NFT gallery.

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

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Before submitting pull request, please make sure:

  • My contribution builds clean without any errors or warnings
  • I've merged recent default branch -- main and I've no conflicts
  • I've tried to respect high code quality standards
  • I've didn't break any original functionality
  • I've posted a screenshot of demonstrated change in this PR

Optional

  • I've tested it at </bsx/collection>
  • I've tested PR on mobile
  • I've written unit tests 🧪
  • I've found edge cases

Had issue bounty label?

  • Fill up your KSM address: Payout

Community participation

Screenshot 📸

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

@netlify
Copy link

netlify bot commented Jan 7, 2023

Deploy Preview for koda-nuxt ready!

Name Link
🔨 Latest commit 862c822
🔍 Latest deploy log https://app.netlify.com/sites/koda-nuxt/deploys/63bec10d4f55c30008d49ff1
😎 Deploy Preview https://deploy-preview-4633--koda-nuxt.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 settings.

@Jarsen136
Copy link
Contributor Author

✅ Tested: the info of gallery item will update after subscription message coming

I relist the nft and change the price from another window. https://beta.kodadot.xyz/snek/gallery/659233203-5
Then the price of nft was changed accordingly, without polling the request. https://deploy-preview-4633--koda-nuxt.netlify.app/snek/gallery/659233203-5?redesign=true
image

image

@Jarsen136 Jarsen136 marked this pull request as ready for review January 7, 2023 06:46
@Jarsen136 Jarsen136 requested a review from a team as a code owner January 7, 2023 06:46
@Jarsen136 Jarsen136 requested review from prachi00 and vikiival and removed request for a team January 7, 2023 06:46
utils/constants.ts Outdated Show resolved Hide resolved
@yangwao yangwao mentioned this pull request Jan 7, 2023
18 tasks
@yangwao
Copy link
Member

yangwao commented Jan 7, 2023

pay 50 usd

@yangwao
Copy link
Member

yangwao commented Jan 7, 2023

😍 Perfect, I’ve sent the payout
💵 $50 @ 24.71 USD/KSM ~ 2.023 $KSM
🧗 Caiv9TbPz68q5dC8EcHu5xKYPRnremimGzqmEejDFNpWWLG
🔗 0xcfccc2b68a37837494f266e27320a8983bf87ea6a40ab8295bd3fbe301570149

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label Jan 7, 2023
@yangwao
Copy link
Member

yangwao commented Jan 7, 2023

@vikiival merge it if good

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

},
})
useSubscriptionGraphql({
query: ` nftEntities(where: {id_eq: "${params.id}"}) {
Copy link
Member

Choose a reason for hiding this comment

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

Why there is a query string? Please use graphqlfile instead as written in the task desc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Largely for two reasons:

  1. The official demo shows that the subscription query should be a string.

image

dev docs: https://docs.subsquid.io/develop-a-squid/graphql-api/subscriptions/

  1. What's more, the graphql file would only export the object type of query. It needs to do some extra work to convert the custom object to string. IMO it's not that necessary to convert it.
    https://stackoverflow.com/questions/59810092/how-to-import-graphql-query-as-a-string-instead-of-an-object

Copy link
Member

Choose a reason for hiding this comment

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

Anyway the query is not correct, please check nftByIdMinimal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I have updated the query.
Now the query string is composed of querys from queries/rmrk/subsquid/nftByIdMinimal.graphql and queries/nftByIdMinimal.graphql

Copy link
Member

Choose a reason for hiding this comment

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

Still this is not correct

You

nftEntities(where: {id_eq: "${params.id}"}) {

nftByIdMinimal

nft: nftEntityById(id: $id) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right! I have updated it.

@roiLeo
Copy link
Contributor

roiLeo commented Jan 9, 2023

related with #2201

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

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

Smol stuff

},
})
useSubscriptionGraphql({
query: ` nftEntities(where: {id_eq: "${params.id}"}) {
Copy link
Member

Choose a reason for hiding this comment

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

Still this is not correct

You

nftEntities(where: {id_eq: "${params.id}"}) {

nftByIdMinimal

nft: nftEntityById(id: $id) {

utils/constants.ts Outdated Show resolved Hide resolved
composables/useSubscriptionGraphql.ts Show resolved Hide resolved
Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

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

Let it roll 🎲

@vikiival
Copy link
Member

Please fix deepsource

Screenshot 2023-01-11 at 14 54 30

@codeclimate
Copy link

codeclimate bot commented Jan 11, 2023

Code Climate has analyzed commit 862c822 and detected 0 issues on this pull request.

View more on Code Climate.

@Jarsen136
Copy link
Contributor Author

pay 70 usd

bounty has been paid in the previous comment.

Please fix deepsource

✅ Fixed

@vikiival vikiival merged commit 20a2529 into kodadot:main Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paid pull-request has been paid
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use subscription to track changes in Gallery Item
4 participants