jacobobryant / platypub

A publishing platform built with Biff
MIT License
65 stars 13 forks source link

Minor fixes #64

Closed jeffp42ker closed 2 years ago

jeffp42ker commented 2 years ago

A few things I encountered setting up Develop in Prod:

  1. An "hx-redirect" header, status 200, to redirect is necessary for the "Message sent." banner to show in prod.
  2. Discourse forum URL needs to test for "" instead of nil to elide comments templating.
  3. Add --allow-overflow fswatch flag to prevent "Event queue overflow." while running prod-dev task (possibly due to three themes in use?).
jacobobryant commented 2 years ago

I noticed the redirect issue yesterday while working on another app. Looks like the root cause was that the location response header is a relative path and gets treated as an http:// address, which I guess is ok for a normal redirect but not as a response to an AJAX request, which is why it breaks htmx. (I think that's what was going on anyway?). I updated Biff's default middleware so it includes wrap-absolute-redirects (https://github.com/jacobobryant/biff/commit/ad2fd9198366dcd407c1a4fc6692dba054279df8) and updated Platypub to the new Biff version. So in future cases regular redirects should work fine with htmx too.