Refactoring Elm

I started the day wrapping up some refactoring work that I began last week. The purpose of the refactor was to streamline the routing in the Elm SPA (single-page application), which was made possible by some of the new goodies that shipped in Elm 0.19.

I debated whether it was worth sinking a few days into upgrading to 0.19 at this stage of the project, but decided it was better to pay the time penalty now than push it out into the future and risk never getting around to it.

Some highlights from the refactor:

✔️ Converted several separate Elm programs to pages in the SPA
✔️ Eliminated the need for a hard page refresh to switch between spaces
✔️ Changed from fragment-based routing to path-based routing
✔️ Reorganized how websocket events propagate through the SPA
✔️ Extracted helper functions to cut down repetition in Main.elm

The highest risk with a refactor like this is scope creep. Since the Elm compiler is always looking out for you, I find it incredibly fun to spend hours tweaking and polishing my code (which is not the most productive use of time) 😉.

I finished the day implementing a mutation for bulk-dismissing mentions from the inbox. For an extra level of polish, I spent about an hour working out how to support keyboard “hot keys” for speeding up operations and had success.

Until next time!


Now read this

Building file uploads

Last week, I predominantly spent my time implementing file uploads. This was a tricker feature implement on the frontend because Elm does not have good support right now for dealing with file objects. It turned out pretty slick! Here... Continue →