Skip to content

refactor: prepare removing /display request on every page load#564

Merged
dergigi merged 6 commits intomasterfrom
prepare-removing-display-request
Nov 17, 2022
Merged

refactor: prepare removing /display request on every page load#564
dergigi merged 6 commits intomasterfrom
prepare-removing-display-request

Conversation

@theborakompanioni
Copy link
Collaborator

@theborakompanioni theborakompanioni commented Nov 5, 2022

In preparation of #356.

Note: The commits of this PR are included in the follow-up PR #566 - you can either review them separately or just review #566.

This PR prepares removing the /display API request on every page load.

/display is a rather expensive request and only needed if 1) the status of an address is requested ('new' | 'used' | 'reused' | 'cj-out' | 'change-out' | 'non-cj-change' | 'deposit') or 2) address-reuses should be checked (which is generally a bit "flawed") or 3) a "new" address is chosen without calling "newaddress" (can be replaced with generating a new address).
This is currently only the case in the JarDetails overlay, pages Send and Sweep or when creating a Fidelity Bond and can be loaded on demand rather than on every page load.

First step in this preparation is to remove to totalBalance and availableBalance properties from the WalletInfo request. Instead, calculatedTotalBalance and calculatedAvailableBalance are used, which use their input data from the more lightweight /utxo response.

Also, on a side note, /display also returns the actual amount of "accounts" (Jars) - there will be a need to load the data once after unlocking and reload only after an impactful action has been triggered.

@theborakompanioni theborakompanioni added the refactoring Code refactoring without functional changes label Nov 5, 2022
@theborakompanioni theborakompanioni self-assigned this Nov 5, 2022
@theborakompanioni theborakompanioni added the performance Performance and/or speed improvements label Nov 5, 2022
@theborakompanioni theborakompanioni marked this pull request as ready for review November 5, 2022 17:18
Copy link
Contributor

@dergigi dergigi left a comment

Choose a reason for hiding this comment

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

Looks good to me, tACK ✅

Good job cleaning up some of the naming as well, it's much clearer now! ✨ 👏

@dergigi dergigi merged commit 24a7ad6 into master Nov 17, 2022
@dergigi dergigi deleted the prepare-removing-display-request branch November 17, 2022 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance and/or speed improvements refactoring Code refactoring without functional changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants