fudgebucket27 / Lexplorer

Loopring explorer alternative
14 stars 10 forks source link

All OnParameterSetAsync methods make calls synchronously #94

Open modersohn opened 2 years ago

modersohn commented 2 years ago

Worst example is probably the accounts page. So many things are loaded with the various services, and everything is loaded one after the other, i.e. slow. No wonder it takes 10-15 seconds for an account with lots of NFTs to actually finish loading.

There's is no reason for doing all of that synchronously - but some things have to be done first and that makes it a bit tricky.

  1. loading the account itself, it's balances, the transactions and the NFT slots can all be done in parallel - because only the accountId is needed
  2. loading the NFT metadata should then be done in parallel too, not one-by-one
fudgebucket27 commented 2 years ago

This is a good idea way to got about it

modersohn commented 2 years ago

It's actually getting quite complicated. First, because you can only call StateHasChanged() from the main/UI thread and second, because there's so much interdependency here.

Then, according to https://docs.microsoft.com/en-us/aspnet/core/blazor/components/?view=aspnetcore-6.0#synchronization-context Blazor enforces a single thread anyway it seems? Which makes me wonder how we could get overlapping calls to OnSetParametersAsync like seen in #87?

Since the whole issue is "nice to have" and it works as is, I'd leave it as is for now.

fudgebucket27 commented 2 years ago

Alright thats fine we can put this on the back burner for now then.

modersohn commented 2 years ago

@danielsolistensvik have you got any experience with this? Is Blazor still enforcing a single thread, like mentioned in the link above?