Skip to content

Conversation

@adrienne-deriv
Copy link
Contributor

Changes:

Please provide a summary of the change.

Screenshots:

Please provide some screenshots of the change.

adrienne-deriv and others added 5 commits August 21, 2023 15:41
Co-authored-by: Sergei Baranovski <120570511+sergei-deriv@users.noreply.github.com>
Co-authored-by: Sergei Baranovski <120570511+sergei-deriv@users.noreply.github.com>
Co-authored-by: Sergei Baranovski <120570511+sergei-deriv@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Aug 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
deriv-app ✅ Ready (Inspect) Visit Preview Aug 23, 2023 7:28am

* If set as an account id, return the balance of that account.
* Default is set to 'all'.
*/
const useBalance = (account?: string) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made account payload as an argument to make useBalance more generic, previous code:
Screenshot 2023-08-21 at 5 20 54 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

@adrienne-deriv No need for this, We will always fetch all. We will be using the useBalance internally in the useAccountList.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2023

A production App ID was automatically generated for this PR. (log)

Click here to copy & paste above information.
- **PR**: [https://github.com/binary-com/deriv-app/pull/9770](https://github.com/binary-com/deriv-app/pull/9770)
- **URLs**:
    - **w/ App ID + Server**: https://deriv-app-git-fork-adrienne-deriv-api-use-balance.binary.sx?qa_server=red.binaryws.com&app_id=23807
    - **Original**: https://deriv-app-git-fork-adrienne-deriv-api-use-balance.binary.sx
- **App ID**: `23807`

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2023

🚨 Lighthouse report for the changes in this PR:

Category Score
🔺 Performance 16
🟧 Accessibility 75
🟢 Best practices 92
🟧 SEO 85
🟢 PWA 90

Lighthouse ran with https://deriv-app-git-fork-adrienne-deriv-api-use-balance.binary.sx/

yashim-deriv
yashim-deriv previously approved these changes Aug 21, 2023
* If set as an account id, return the balance of that account.
* Default is set to 'all'.
*/
const useBalance = (account?: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

@adrienne-deriv No need for this, We will always fetch all. We will be using the useBalance internally in the useAccountList.

*/
const useBalance = (account?: string) => {
const { data: balance_data, ...rest } = useFetch('balance', {
payload: { account: account ?? 'all' },
Copy link
Contributor

Choose a reason for hiding this comment

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

@adrienne-deriv Maybe use option to add a fetch interval until we have a subscription? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Dont we have subscription already?

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Clarified with @yashim-deriv, when all is passed as payload to account, it is not subscrible-able, but when a loginid is passed instead, the endpoint is subscribe-able

Copy link
Contributor

Choose a reason for hiding this comment

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

We can only subscribe once to each endpoint, Otherwise, we will get an error from BE that you are already subscribed. Since the client store is in the background subscribing to balance we can't subscribe again here. Instead, we will do a periodic fetch for now until we can serve the wallet without the core package.

farzin-deriv
farzin-deriv previously approved these changes Aug 21, 2023
farzin-deriv
farzin-deriv previously approved these changes Aug 22, 2023
@coveralls
Copy link

Coverage Status

coverage: 10.121% (-0.01%) from 10.131% when pulling cd98dc4 on adrienne-deriv:api-use-balance into bc8882d on binary-com:master.

@yashim-deriv yashim-deriv merged commit 1355c47 into deriv-com:master Aug 23, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

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.

5 participants