miguelgrinberg / turbo-flask

Integration of Hotwire's Turbo library with Flask.
MIT License
301 stars 35 forks source link

Dynamic update not working in turbo-flask 0.8.1? #40

Closed andyengria closed 1 year ago

andyengria commented 1 year ago

When following your blog post / guide on Dynamically Update Your Flask Web Pages Using Turbo-Flask I found the dynamic update is not working with turbo-flask 0.8.1 and the example code. It does work with 0.8.0. Is this due to a bug in 0.8.1 or has the method of making dynamic updates work changed?

miguelgrinberg commented 1 year ago

Looks like the CDN that hosts the Turbo JavaScript code is having an issue with the latest version: https://github.com/hotwired/turbo/issues/735. The 0.8.0 release works fine because that loads an older version of turbo.js.

I'll keep an eye on this issue and if they don't fix it I'll move to another CDN.

brianm-sra commented 1 year ago

I was also noticing this. The load example, and my own code based on it, was working a few weeks ago, but not anymore.

brianm-sra commented 1 year ago

How do we specify to use the older version? Uninstall turbo-flask with pip and reinstall with a specific version number ? Modify one of the .py or .html files ?

brianm-sra commented 1 year ago

Or do we need to wait for the CDN issue to be resolved ?

miguelgrinberg commented 1 year ago

You can run pip install turbo-flask==0.8.0 to force this version to be installed. If any other version are already installed, it will be removed first.

brianm-sra commented 1 year ago

Yes, that worked for me. Thank you. With 0.8.0 the dynamic updates happen in the browser.

oliverwehrens commented 1 year ago

It seems like the CDN url is wrong.

https://cdn.skypack.dev/pin/@hotwired/turbo@v7.2.2-RBjb2wnkmosSQVoP27jT/min/@hotwired/turbo.js https://cdn.skypack.dev/pin/@hotwired/turbo@v7.2.0-RBjb2wnkmosSQVoP27jT/min/@hotwired/turbo.js

are working.

https://cdn.skypack.dev/pin/@hotwired/turbo@v7.2.0-jLjGyoEW3JseSmRfJh2M/min/@hotwired/turbo.js

Is not (which is in 0.8.1)

See https://github.com/miguelgrinberg/turbo-flask/pull/41

miguelgrinberg commented 1 year ago

The URL isn't wrong, they have just released a new version on top of the broken one. In any case, 0.8.2 is now released with this fix. Thanks!

oliverwehrens commented 1 year ago

Jep, now it should work again with the 0.8.1 version I guess.