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: APP-491 empty choose credits form appears for ms #2591

Merged
merged 8 commits into from
Feb 13, 2025

Conversation

r41ph
Copy link
Contributor

@r41ph r41ph commented Feb 5, 2025

Description

https://regennetwork.atlassian.net/browse/APP-491

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • provided a link to the relevant issue or specification
  • provided instructions on how to test
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

How to test

  1. Login with a user. i.e our testing account (Sarah McFee)
  2. Go to a project where the user is not allowed to buy credits. i.e: https://deploy-preview-2591--regen-marketplace.netlify.app/project/C01-010
  3. Manually update the URL to go to the buy page by adding /buy at the end. i.e https://deploy-preview-2591--regen-marketplace.netlify.app/project/C01-010/buy
  4. The user should be redirected to the project details page without seeing the BuyCredits page first.

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items
.

I have...

  • confirmed all author checklist items have been addressed
  • reviewed code correctness and readability
  • verified React components follow DRY principles
  • reviewed documentation is accurate
  • reviewed tests
  • manually tested (if applicable)

Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for terrasos ready!

Name Link
🔨 Latest commit bb54dde
🔍 Latest deploy log https://app.netlify.com/sites/terrasos/deploys/67adc2d37a15110008bff51c
😎 Deploy Preview https://deploy-preview-2591--terrasos.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.

Copy link

netlify bot commented Feb 5, 2025

Deploy Preview for regen-website ready!

Name Link
🔨 Latest commit bb54dde
🔍 Latest deploy log https://app.netlify.com/sites/regen-website/deploys/67adc2d33223db0008966ca9
😎 Deploy Preview https://deploy-preview-2591--regen-website.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.

@r41ph r41ph requested a review from blushi February 5, 2025 13:56

const availableSellOrders = allSellOrders?.filter(
(sellOrder: SellOrderInfo) =>
sellOrder.seller !== activeAccount?.addr &&
Copy link
Member

Choose a reason for hiding this comment

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

best to check wallet?.addr which is the addr currently connected, because if the user is connected with wallet connect, activeAccount?.addr will be empty

@r41ph r41ph marked this pull request as ready for review February 10, 2025 09:12
@r41ph r41ph requested a review from blushi February 10, 2025 09:12
@r41ph
Copy link
Contributor Author

r41ph commented Feb 10, 2025

@erikalogie @S4mmyb see testing instructions

@erikalogie
Copy link
Collaborator

LGTM

const activeAccount = authenticatedAccounts.find(
account => account?.id === activeAccountId,
);
currentActiveAddress = activeAccount?.addr ?? undefined;
Copy link
Member

Choose a reason for hiding this comment

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

I still see the empty choose credits form when logged in with wallet connect, this is because here we check the activeAccount?.addr instead of wallet?.addr
see my previous comment: #2591 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We are checkingwallet?.addr as well. The issue was that we weren't passing the address param to getRegenRouter. Although, I'm not fetching the activeAccount?.addr anymore because I have updated BuyCredits.loader.ts and Regen.Routes.tsx to use activeWalletAddr instead of wallet as activeAccount?.addr is checked in useWallet().

Note that the ternary in the dashboard route that is using address was always pointing to /projects because there was no address param, so that should be fixed too.

@r41ph r41ph force-pushed the fix-APP-491-empty-choose-credits-form-appears-for-ms branch from 647cdd2 to 6a6c779 Compare February 11, 2025 11:21
@r41ph r41ph requested a review from blushi February 11, 2025 11:55
Copy link
Member

@blushi blushi left a comment

Choose a reason for hiding this comment

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

tACK nice work!

};
/**
* Loader function for the Buy Credits page that checks if there are available
* sell orders in a given project for a given account address
Copy link
Member

Choose a reason for hiding this comment

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

we could clarify that there are available sell orders if the current account address is not the seller of all available sell orders

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! And good point, I've updated the comment to make it clearer.

@r41ph r41ph force-pushed the fix-APP-491-empty-choose-credits-form-appears-for-ms branch from beb0b4e to bb54dde Compare February 13, 2025 10:00
@blushi blushi merged commit f966436 into dev Feb 13, 2025
17 checks passed
@blushi blushi deleted the fix-APP-491-empty-choose-credits-form-appears-for-ms branch February 13, 2025 13:14
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.

3 participants