-
Notifications
You must be signed in to change notification settings - Fork 1
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
Show progress query #23
Conversation
Use a best-effort approach and record only the confirmed transactions, then we can refine it. In practice, every time you send a transaction keep track of its hashID, if you get back a confirmation (or the result) move to the next one, etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks good I also tried it locally, and I would still give it a try to implement the state tracking as explained above. Also, I left a question below.
e0fb0de
to
2de6be6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for merging for this:
Use a best-effort approach and record only the confirmed transactions, then we can refine it. In practice, every time you send a transaction keep track of its hashID, if you get back a confirmation (or the result) move to the next one, etc.
That's it, this is the best I could achieve without changing how the SDK works too. I was able to implement only one checkpoint but the logic can be extended in the future with more of them, maybe. Once the requestID is obtained the first time, a snapshot of the query execution is saved in the localStorage. When #22 will be merged, it will become possible to integrate a slightly more complex logic that could handle also swapping the wallets without reloading the page. What's needed is to change the data structure saved in the cache from an object to a "dictionary" of objects: {
"0x<USER_1>": { <QUERY_STATE_FOR_USER_1 },
"0x<USER_2>": { <QUERY_STATE_FOR_USER_2 },
...
} The page will check if, for the currently selected user, the cached query state (if not existing it must be initialized) tells that a query is still unfinished, and act accordingly. |
30470a8
to
627d02f
Compare
627d02f
to
3f3fb64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just tried locally. I found an issue, step to reproduce:
- issue a query
- wait till stage 3 Executing query ( do all the transactions requested)
- reload the page
- the DApp correctly asks for resuming the query
- it starts from stage 2 and ask for doing the transactions again.
I added the handling of "user changed" events, which works exactly as explained in a previous comment: #23 (comment).
Due to some limits of the actual interface of the Desmo class in the SDK, it's not possible from outside the SDK to know at which point of execution we are. The only thing we can know at the moment is whether the Actually, I now added another checkpoint that could be useful. It saves the query built by the user before retrieving the The current code can be easily extended with (an)other checkpoint(s), but this would require changing the SDK interface for the Desmo class (refer to vaimee/desmo-sdk#12 (comment)). |
Did the same thing and the problem remains; I'll merge this PR and open an issue to keep track of that bug. |
closes #11 .
Added visual feedback on the query execution.
After some trial, I was not able to implement this part. It's quite difficult to keep track of the current state of the query execution process if the page is reloaded (e.g what if the page is reloaded when the frontend is waiting for the query to being bought? Do we buy it another time? what if the MetaMask user is changed?...).