Misago icon indicating copy to clipboard operation
Misago copied to clipboard

Replace React.js components with HTMX

Open rafalp opened this issue 2 years ago • 3 comments

HTMX is a tiny library that lets developers specify parts of HTML as dynamic islands that can be swapped by new server-rendered HTML on interaction.

This approach is a declarative way to doing $.get("/url/", ".outlet") of the yore times. Interactivity may not be as amazing as what React.js offers, but:

  • Its much smaller (15.4kb after gzip).
  • Final JS is much smaller (we only need to cover things like dynamic timestamps, Bootstrap's JS for modals/dropdowns, quote and message editor).
  • UI is interactive faster on page load.
  • Much more UI can work without JS
  • Single HTML location (Django's templates)
  • Much easier to work with for Django devs
  • Much easier to manipulate and extend with plugins
  • Can be done incrementally (move page after page away from React.js)

Forum thread for discussion:

Removing React.js from the codebase and adapting HTMX for UI interactivity

rafalp avatar Dec 05 '23 13:12 rafalp

This is a much better solution IMO than going full React. Web dev is currently swinging back towards server-side rendering. The interactivity provided by HTMX is plenty for this type of app.

frankwanicka avatar Dec 06 '23 15:12 frankwanicka

I've created a ton of "Remove React.js from..." tasks.

In next release I will remove React.js from categories (#1683) because that one is easiest to do.

After that I'll prioritize, in this order:

  • #1688: its easy to do and will simplify adding new user features in future.
  • #1686: its most complex and important page on a forum.
  • #1685: its second most complex and important page.
  • #1687: its been very bad forever and desperately needs a make-over.

I would like to ship Misago 0.40 with new permissions system and the above. It may take a while to get done, but it will open the floodgates to many improvements in what are key parts of the forum.

rafalp avatar Dec 13 '23 13:12 rafalp