-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Implement a check that the development server is back before reloading a page #46
Comments
There is already such a check. The JS detects the server restarting and waits until it manages to connect to the 'events' view before it triggers a reload. I'm not sure what's going on in your example. Do yyou have any other scripts on the page, a proxy server, etc.? |
Oh I had an idea what may be happening:
Not sure why you then get a second reload and actually see the content. The JS should stop running at this point. Anyway, do you think this could generally be what's happening? One question I have is: why does django even need to restart when the generated CSS changes? Reloading Django can get seriously slow with a good amount of dependencies, as Python has to reprocess all the imports. If you could rearchitect your library to avoid the restart, that would be ideal. On my project using plain tailwind, there wouldn't be a restart. The tailwind watch process just places CSS into the |
I had a second theory - perhaps the development server isn't actually reloading, and what's happening is something like:
I think we could solve that kind of problem by debouncing via |
Adam, thank you for taking your time and looking into the issue. What you've described is what's actually happening. My library uses barebones Tailwind without any custom node reloaders. I got rid of them in favor of your package. So nothing is sitting in between. It's just the tailwind process running and the stylesheet link included on the page. I narrowed down the issue to the The weirdest part is that the observed behaviour isn't happening all the time. Not sure how Anyways, I'll continue digging when I get some free time and will report back. Thanks. |
The server is reloading, I see that in the terminal.
No I don't use Watchman, just standard |
If it's only sometimes, that is weird. It should be deterministic. Inside |
Adam, I've enabled logging and here's what I get when the server restarts:
The key is this message:
It only happens when I add a new CSS class to the HTML, which triggers Tailwind to rebuild the stylesheet. But should the |
That is indeed not expected behaviour! I made a mistake in the static file reload code - fixing now. |
Released in 1.1.1, can you try that out? |
great, thank you, Adam. I'll be back in 2-3 hours and will try it out. |
Adam, I upgraded and it works flawlessly now, thank you for such a quick reaction! |
Was just about to raise this exact issue - updating to the latest version fixed it. Thanks both. |
Description
Hi Adam,
I'm trying to get django-browser-reload work with Tailwind CSS, and I'm almost there. However, I noticed a weird lag happening sporadically after I edit HTML code - the page reloads and shows the "No server response" and then reloads again and shows the working page. I guess that's because the reloader tries to fetch a page while the Django server is restarting. Please see the attached video. The behavior I'm describing happened in the second part.
So I was wondering if it's possible to implement a check that the development server is back before reloading a page?
PS: Thanks for the package!
The text was updated successfully, but these errors were encountered: