wails: [V2] Mac: The page not rendering
Description
@leaanthony @stffabi I have written code to reproduce the render problem. The following are expected and unexpected result.
Expected:

UnExpected:

To Reproduce
- wails build (–debug)
- open / close App repeatedly and repeatedly…
- sometimes the page will not render
- (I guess) If you click jump, the probability of occcuring problems will increase
Expected behaviour
solve it - -
Screenshots
No response
Attempted Fixes
No response
System Details
unnecessary...
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17
@cxt90730 PR #1681 is up which should fix your issue. Would it be possible for you to give it a try?
Awesome, thanks so much for testing the PR. 🙏
@stffabi That’s great ! I’ve tried about half an hour and the rendering problem not occurs again 👍 And same fix with my previous App 😃
@cxt90730 awesome thanks for this information. The hanging request is causing your problem, and I think I know what’s going on…
I’m going to create a PR which should fix the problem. I’ll let you know when it’s up…
Yeah exactly, I’ve already started fixing it. I will let you know when you can test the PR.
No worries, testing and giving detailed feedback like you do is very valuable 🙏 . Thank you very much for improving Wails.
@stffabi Thank you for your reply ~ In fact, I don’t know if this problem is the same as the problem that
Vuerouter.push not works when the "Login button" clickedI mentioned before (although the results is same that the picture assets cannot be loaded), maybe current issue is a new problem… I personally feel, according to your description, it needs to make the callback name have uniqueness in the dictionary or add lock or mutex on the key in the dictionary? I’m sorry I have limited ability to modify wails source code and to debug and fix it 😦Sorry didn’t have enough time to write down the details earlier.
In the callback from the native WKWebView a task object needs to be hold, then there’s a callback into the go side where the request is processed (asynchronously). In order to finish the request Wails calls into the native part, gets the task object and finishes the request. The task object is hold in a dictionary indexed by the request url. If now two identical requests are sent (which seems to be the case for you) and it happens that the first request is still running, the second might overwrite the entry in the dictionary. So one of the tasks can never be finished and the attached request will remain in pending state.
The minimal reproduction guide to trigger the issue:
wails init -t plainwails build --debugfetch("assets/images/logo-universal.png");fetch("assets/images/logo-universal.png");pendingstate in the network tab.@stffabi Respect for your hard work, and thank you very much for your support ! I also want to know what caused this incredible problem… hope your answer ~
@stffabi I can reproduce it by clicking repeatedly
reloadsbutton on the dev tools. No error log shows onConsole tab,Network taband terminal. But, the obvious thing is that fetchingHelloworld.xxxx.jsare blocked !! I find this problem on theNetwork tab. The following is the desktop capture.