krompaco / hotwired-aspnet

A Blazor SSR sample site with CLI setup for Tailwind CSS and Webpack for Hotwire with Turbo and Stimulus
33 stars 1 forks source link

Progressive Enhancement #2

Open jf26028 opened 1 year ago

jf26028 commented 1 year ago

One of the benefits for Hotwire is progressive enhancement: https://www.google.com/search?q=hotwire+progressive+enhancement

The player list page does not work with javascript disabled.

When you create a new Player or edit a Player with javascript disabled, the page works as expected. And when you submit the form, the data is sent to the server but the response is a partial view and the page breaks.

Reproduce:

  1. disable javascript
  2. navigate to https://hotwired.azurewebsites.net/PlayerList
  3. add a player
  4. submit the form
krompaco commented 1 year ago

Thanks!

I'm aware and I think the solution would be to inspect if the Turbo Stream header exists or check for the standard AJAX-call header.

If it's not there; add a way to render a fallback page or re-work the current handlers involved to all be own Razor Pages so that it's easier to get a full response with layout file etc. Not sure which solution sounds best?