srid / ema

Change-aware static site generator for Haskell programmers
https://ema.srid.ca
GNU Affero General Public License v3.0
117 stars 9 forks source link

Malformed HTML breaks morphdom (link click fails) #65

Open srid opened 2 years ago

srid commented 2 years ago

If the HTML served is malformed, the dev server's web socket code is unable to switch to the new page on link clicks because morphdom fails to apply the new HTML. The user will see the new URL appear in address bar, but the HTML itself wouldn't change.

Proposal: have Ema display a 'Bad HTML' error message in place.

Here's one malformed HTML:

<meta property="og:title" content="Posts tagged " non-tech" - Maralorns Blog">
srid commented 2 years ago

Basically, we should handle exceptions from JavaScript around here - and display them in the browser:

https://github.com/srid/ema/blob/06402ea7f368e161d9865038cdcb4d4ef2a4ec86/src/Ema/Server.hs#L211-L212

Make it clear to the user that they are responsible to fix malformed HTML being sent.