Better URLs with filters

Nate Agrin · Friday Demos · December 2, 2024 · 7:28

A first look at our new dashboard URLs - now folks can easily work around URL encoding for simpler parameterization and control

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. now um sorry I won't be able to join you on Monday uh I'll be traveling home from a trip with my family but I wanted to share what I've been working on for the last couple days uh for the sort of quality of life hack week um so the thing I've been working on is trying to improve some of our dashboard filter syntax um specifically in the URL uh and so I've got this dashboard here on playground that's the basically the current existing implementation and I'm going to show you how it works first so you're all probably familiar with this but basically uh whatever values I pick here end up getting persisted in the URL the nice quality of this is you can grab this

  2. URL and you can share it with anyone um and uh you can see that as I add more and more filters these things get pretty large and long um and additionally they're kind of opaque like clearly there's some kind of structure uh up here and it's not super clear exactly uh if you wanted to like hack this like how you would go about hacking it and keeping it valid um and you know as these things get longer they've created a number of issues for us and we've kind of been dealing with those issues um Peace meal um we've kind of stretched the runway out on this particular implementation um of serializing these large objects into the URL uh most notably Eli recently greatly reduced the

  3. size of those objects um for for most cases but you can still occasionally fall into these scenarios where um the entire state of a filter gets serialized into the URL making them really really long um yeah so here are just a couple bugs that have fallen out of that uh the result of like filter values getting really really long um so what are alternatives well basically we could come up with our own more expressive Syntax for filters and it turns out if you're familiar at all with the filter syntax in the model that already exists so for example um if you want to declare a filter on user State directly in the model you just get to use syntax like this very straightforward very human

  4. readable and so some months ago Stephen and I were talking about using this uh as the sort of vanity filter syntax in the URL and so that's what I've spent the last couple of days working on demo of my implementation using the filter syntax from the model so um you can see got this simple dashboard with two filters one in user gender one in user State now keep in mind this is not bug free it's not production ready um still have to iron out some of the Kinks with some of the more complicated filters like date filters uh but I am getting pretty close so to give you a quick demo um let's say I choose filter value female you can see up here in

  5. the URL now have this really nice trivial syntax super easy to understand very expressive I can update it to a different filter value works exactly as we'd expect um and I can even change the filter type and uh this should work exactly as we expected to and you can see filter type is switched to contains and uh to give to make this demo even uh sort of clear I can directly add in um my own filter value for this other filter so let's look for a state that has that contains fornia we'd expect to come back with California and here it is um yeah so this is really super nice um we should expect it to support pretty much everything filter currently support so here

  6. you can see um we my contains for this state Got Ur all encoded which is why these percent showed up um but the users gender now just shows is female come mail um like in theory we could also add uh another value and that gets propagated here um so yeah just super simple to work on and work with and um just to emphasize why I think this is really valuable uh in the embed world we currently allow folks to parameterize their embed URLs with filters and we require them to use the pretty large complicated Json structure that filters currently have and so this would be a pretty big quality of life Improvement for embed users who are parameterizing by filters um and and perhaps even

  7. more importantly you know in we use filter values kind of all over the place um and like a good example is like the links property in uh the model where you know if you get a value like if you use this field in your query and you get a value in a table and you click on that cell um we're going to open a menu with this link and right now if you want to parameterize that link um you have to copy and paste the the filter URL from this like directly out of the browser and then figure out exactly where to splice in your Dynamic value that's coming from The Click event um and so instead of doing this crazy thing we could potentially

  8. just shown it to something like this um so yeah again a lot a bit of work still needs to be done to make this production ready and shippable um I'm pretty pleased with how well it's working so far just need to you know make sure we cover all of the filter cases and um ensure we handle things like complex uh like multicondition filter values um date filters things like that uh so yep that's my demo thanks see you all at the end of the week