Progressive form enhancement with SvelteKit
Hello, and happy Monday!
Last week I wrote a post about one of my side projects, a site that displays Marvel comics by release year. This site has a page for each year that lets you filter the comics that are shown (e.g. by title, release date, or creator).
I recently did a lot of progressive enhancement experiments with Advent of SvelteKit 2022 (which should be my next blog post) and wanted to bring over some of those techniques to this site. My goals were:
- Move filter state into the URL to make sharing and persisting filter state easier
- Use web platform primitives like
I wrote about my solution, which features some techniques I’m excited to write more about, including:
- parsing/validating URLSearchParams using Zod
- using query params in the URL as the source of truth instead of binding to inputs directly
- automatically submitting search forms client-side with form.requestSubmit
Check it out here: Progressively enhancing the Marvel By Year filter
I was hoping to wrap up a blog post this weekend but ended doing some maintenance on my SvelteKit adapter for Azure Static Web Apps instead. Right before writing this, I got out a new release for SvelteKit 1.0. I also went down a bit of a rabbit hole with how SvelteKit can integrate with Static Web Apps’ built in auth capabilities. If you’re interested, here’s the issue where I’ll be tracking my findings. I’ve already had someone reply with how they’re approaching it, which is neat - gotta love open source!
I also opened a bunch of issues on the aforementioned Marvel side project to track what else I want to do with it. This was inspired by Simon Willison’s talk on strategies for maintaining personal projects, one of which is creating an issue for everything. I want to be more intentional about tracking my thoughts on certain issues so that when I do want to implement it, all the context is right there. And if it’s publicly available, other people might add their thoughts too! (which is usually a good thing, but not always)
Don’t have time to pick out links this week - I’ll save them for the next one.
It’s been cold lately so the cats had a good cuddle on the couch.