73
you are viewing a single comment's thread
view the rest of the comments
[-] bleistift2@sopuli.xyz 0 points 1 day ago* (last edited 1 day ago)

So we’re back to fully static pages and rendering HTML on the server? That sounds like a terrible idea. I don’t want to preload 10 different pages (for opening various filtering forms, creation forms, more pages of the user list, different lengths of the user list, different orderings of the list, and all combinations of the above) just in case a user needs one of them, which they mostly don’t.

[-] python@lemmy.world 2 points 1 day ago

Huh, wouldn't just plain sql be perfectly fine for that use case? Make a get request with your filter/sort params, server-cache the result, return the data with a client-cache header. I've been serving up customized svg files like that in a personal project of mine and its been so much faster and cleaner than styling my svgs within the jsx.

[-] bleistift2@sopuli.xyz 1 points 1 day ago

That would work, but it demands co-operation by the backend for the additional validation. It also means re-transmitting 8MB of customer data just so they can be arranged differently in the frontend. I don’t really want to move presentation logic that far to the back. If you want to display more data, you need to touch both the table-drawing logic and the sort-validation logic.

[-] python@lemmy.world 1 points 18 hours ago

..i mean, I get it, I've written some very scuffed JS in my time because using .filter() right before displaying my data felt easier than getting the right data to begin with. Especially if the backend is in a different git repo and uses some whacky ORM library I'm not familiar with, while the Product Owner n e e d s everything deployed today.

But you can't tell me that applying filter/sort to 8MB of data in the frontend is anything but mega scuffed. Imagine you need to debug that and don't even have an intermediate step to see whether the wrong data is arriving or whether filter/sort logic is wrong for a specific case, or whether its just the rendering. You'd always need a person understanding all three just to debug that one part.
Not to even mention how that would run on low-power devices with bad internet connection. Or what that does to your SEO.

[-] bleistift2@sopuli.xyz 0 points 5 hours ago

filter() right before displaying my data felt easier than getting the right data to begin with.

The issue here is that you don’t know what the right data is to begin with. SAP does what you’re suggesting. They demand you set the filters correctly before requesting any data, which is a terrible user experience.

Imagine you need to debug that and don’t even have an intermediate step to see whether the wrong data is arriving or whether filter/sort logic is wrong for a specific case, or whether its just the rendering.

That’s a strawman. Why would I not know what data arrives in the frontend. That’s what the network debugger is for. That’s what a breakpoint before the filter is for.

But you can’t tell me that applying filter/sort to 8MB of data in the frontend is anything but mega scuffed.

Personally, I find re-transmitting those 8MB of data for every different sorting request way worse. Remember that this isn’t even cacheable, because the data is different for different sorting requests.

Maybe we have different types of frontend and different levels of user proficiency in mind. In my case, I cannot possibly ask the user to know how they want a list sorted and filtered before seeing the list and the options. They’d throw the frontend in my face. If you have very knowledgable users that know what they want from the get-go, then it might be possible to show them a form to sort and filter and only request the data when the user sends the form.

Not to even mention how that would run on low-power devices with bad internet connection.

I don’t see how ‘bad connection’ is an argument in favor of re-requesting data just for it to be displayed in a different order. I’ve made this back-of-the-envelope calculation in another comment. For a good connection, latency is about 20ms. In that time a 1GHz processor can to 20 million operations. Take 10 operations for each comparison (to adjust for more complicated comparisons), and you can use 2 million comparisons to sort the list in the time it takes to re-fetch it. (Keep in mind that the act of rendering the HTML itself is also computationally expensive for tables). 2 million comparisons sorts a list of 120,000 entries.

this post was submitted on 26 Jul 2025
73 points (94.0% liked)

Web Development

4379 readers
19 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 2 years ago
MODERATORS