Closed datencoach closed 2 years ago
what browser? safari is known not to work
you can debug the worker and check its log messages: https://lihautan.com/Debugging%20web%20workers/
Chrome and Firefox, sorry for leaving out. There is no workers context in dev tools.
any logging in your console on main pages?
you can see what will be logged in the scripts
https://github.com/adamchainz/django-browser-reload/blob/main/src/django_browser_reload/static/django-browser-reload/reload-listener.js https://github.com/adamchainz/django-browser-reload/blob/main/src/django_browser_reload/static/django-browser-reload/reload-worker.js
Maybe relevant, ./manage runserver
works but ./manage runserver_plus
(django-extensions) doesn't
@shawnngtq that is probably a different issue. Can you open one? Also I don't particularly care to support django-extensions but if you can find a simple patch or docs fix I would merge that. Possibly runserver_plus
doesn't support threads or long running views by default.
It's ok, I just stick to the ./manage runserver
, this is a feature and not a bug. And not a very important one. 😁
Just thought that datencoach might be doing it via ./manage runserver_plus
.
No, I am using runserver
. I did not have a chance to check during weekend and will not be able to check today. But there are no logging messages in the console. I will compare it with the working project and provide screenshots. Thanks for your help.
No output to console in browser. Of course, no new request to the server. But CSS was rebuilt after change in HTML.
I checked again the project I updated earlier, no problems. Reloading on any change.
Please also check the worker logs as per the link in my first comment
No workers in Javascript context and no workers in "shared workers"
As mentioned before the script tag is set in the source code
You may have something on your page that prevents the script even starting.
If you see the listener script logs if it's not possible to start the worker:
So either you should see that message, or the worker should start.
Are you allowing debug-level messages on your devtools console?
Are there other messages you're ignoring?
Can you try adding extra log messages to your local version of the script (edit it within your virtualenv) to see where it gets to?
Thank you for your help.
I put some console log statements into the script. The script runs. A worker is created. EventListener does not receive any events to trigger the reload.
Okay - that's interesting. Would you be able to add some print()
statements into the view to determine if a connection is made, and if ping messages are sent?
(I opened #69 to add some log messages to the source permanently, for future debugging.)
Sure.
View events
is running on startup and page refresh. Function event_stream
is called and while loop is running. should_reload
is set to True
after change and save on a html template.
But still no refresh within the browser. As written before. Same setup on a different project work just fine. I am not able to spot any difference.
Huh. And this is with normal runserver
, no packages replacing it, and you're not using the --nothreading
option?
I would normally ask to reproduce the bug in a small project but I suspect it would be hard to do so without narrowing down the problematic component.
yes, straight runserver
. nothing fancy.
The only difference is Wagtail. The running project is straight Django.
No worries. I can work without reloading. And if no other user has the same problem, we should not spend too much time on it.
I'm happy to keep debugging, if you are.
As I understand, you added print()
s within the while
loop, so you could see messages were being yield
ed by the view? That would imply that a worker is running and connected, and somehow receiving them...
Sure, I am.
Yes, correct.
Okay, it seems impossible then that you'd not see a worker running. Clearly something is connected and receiving the events. Can you try checking the relevant debugging panels in both browsers, as per https://lihautan.com/Debugging%20web%20workers/ ?
I still do not see any worker in javascript context
But I can see it on chrome://inspect/#workers
Still no reloading.
Checked on the "running" project. Same picture.
Okay, I finally give up.
For your case, we've seen the server side component is running and sending messages, and the client side component is connecting and logging its "connected message". So it seems almost impossible that it wouldn't work.
Perhaps you have some kind of development tool (an option in devtools, or an extension) that is blocking the exact JS API's used to signal the reload.
I'd recommend you try a clean chrome profile with no extensions, or even another browser (Firefox!).
Happy to fix something if you get more data on this, but it seems the package is working fine for at least hundreds of people at this point, so it's probably not an issue here...
Thanks for your help. Yes, I agree. The browser is not the problem as it is on any browser the same problem and it works with another project with identical setup. ... I could try screen recording to proof it is not working, but anyway. Fine with me. I will change my development setup shortly and it will be interesting to see if it works on the new laptop. Thanks, Adam. I appreciate your efforts to help me.
I have what appears to be the same issue with both latest Firefox and Brave on macOS 12.5.
@rakyi Open a new issue if you have any new information. Please try capturing the debug logs at least.
Python Version
3.9.10
Django Version
4.0.2
Package Version
1.3.0
Description
Did an update on django-tailwind from 2.x to 3.1.1 and also changed from browser-sync to django-browser-reload. Followed the update instructions and compared all steps to a previously updated project without any problems.
But this time the browser just does not reload on changes. The script-Tag is in the source code of the page. Tailwind start does recognize the updated html or css. But the browser does not reload. No GET request to update the site is fired.
Do you have any idea where I can look for the problem?