Open lyonsil opened 1 year ago
I guess it has to do with how we're running setIsLoading
in the hook in two different async functions. Just feels a bit shifty.
I saw this in the Text Collection extension today, too. Note the "Loading" text beside HPB despite the fact that HPB was loading fine since you could see the whole chapter to the right of it in the same webview. Unfortunately just changing the BCV doesn't clear it (at least not in this control).
Describe the bug When changing BCV repeatedly, the resource viewer will occasionally get stuck showing
Loading
instead of the right part of scripture. It appears to be related to theisLoading
flag in this part of theresource-viewer.web-view.tsx
:When the code is changed to ignore
isLoading
, the resource viewer continues to show scripture properly as expected.To Reproduce Steps to reproduce the behavior:
isLoading
flag fromuse-data.hook.ts
.<
and/or>
button to change books and chapters in quick succession.Loading
. Changing BCV again usually clears it up after one or two updates, but sometimes it takes more.Expected behavior The resource viewer should always update to scripture that matches the BCV control.
This is likely an issue with the pattern that people are expected to use
isLoading
fromuse-data.hook.ts
, not something specifically wrong with the resource viewer per se. Either there is a bug inuse-data.hook.ts
or the documentation is suggesting the use of return values in a way that is not thread safe across async calls.