113 points
*

Anyone that builds a SPA and breaks opening in new tab or history caching and back/forward nav isn’t a good frontend developer (or lacks experience, which is something that’s fixable!). These have been solved problems for a long time.

permalink
report
reply
36 points

I mean, for sure, and this meme isn’t trying to say that all SPAs are bad. But defaults matter, even for experts.

This meme was inspired after I had to use an SPA, which among those points in the meme, also broke using Alt+Left to navigate back. The normal back-button worked (even if it then had to load for ten seconds to re-display static content).

Which is just a typical example to me. You don’t even need much expertise to figure out why Alt+Left is broken. But you have to think of testing Alt+Left, because it’s broken by default.

permalink
report
parent
reply
8 points

My friend I’ve been using the Internet for 27 years and developing for it for most of that time and I can promise you I’ve never once hit Alt+Left

permalink
report
parent
reply
24 points

As your younger and more modern replacement, I use it regularly

permalink
report
parent
reply
10 points

I have never heard of alt+left, and I’ve been using the Internet since Mosaic was all the rage. Shame on me, it seems to be implemented in all browsers. How could I have missed it?

permalink
report
parent
reply
10 points

Yeah, I have no trouble believing that. It took quite a while before I learned of this shortcut and when I did, I was wondering why I would ever want to use it.

But I generally work from my laptop these days, without an external mouse connected, so reaching from my touchpad, the Left key is right there.

permalink
report
parent
reply
6 points

I started using alt+left when browsers started removing backspace. It was for the best.

permalink
report
parent
reply
6 points

Just here representing the Cmd+[ gang

permalink
report
parent
reply
2 points

Ctrl+[ here

permalink
report
parent
reply
20 points

I’m guessing they aren’t using Vue, React, or similar, and they’re rolling their own for some reason.

permalink
report
parent
reply
21 points

React doesn’t handle any of this stuff out-of-the-box; it’s just a UI library.

permalink
report
parent
reply
3 points
*

Neither does vue. You need vue-router, which is required anyway to make an spa with multiple pages.

The only thing that breaks is any component state isn’t saved. But this can be fixed by rendering <RouterView> with <KeepAlive>. How to do this is mentioned in the documentation.

I assume it’s similar with react and react-router-dom.

permalink
report
parent
reply
-4 points

It’s one install line ffs, how is this a conversation in 2024? It’s EASY.

permalink
report
parent
reply
4 points

Conversly a lot of static websites break new tab by incorrectly slapping target="_blank" on anchors. Luckily Lemmy doesn’t mess this up.

permalink
report
parent
reply
1 point

I maintain a couple of Wordpress installations for clients, where new link targets are the same page, as you’d expect.

They still, somehow, manually check “link opens in new tab”. I don’t know why some of these boomers are allowed to use computers, I swear.

permalink
report
parent
reply
2 points

If you manage the WordPress installation, can’t you disable the ability or create/install a plugin that removes that ability? This hurts usability.

permalink
report
parent
reply
3 points

If your SPA website is done correctly the end user won’t even notice and none of the bad things listed in this meme happen.

permalink
report
parent
reply
85 points

I FUCKING LOVE STATIC HTML PAGES

I LOVE NOT HAVING TO RELY ON SCRIPTS TO DISPLAY CONTENT

permalink
report
reply
66 points

Welcome to our homepage! We have implemented the navigation menu in Adobe Flash Player to maximize your audio visual experience.

permalink
report
parent
reply
6 points

that’s some PTSD comment right there, I’m getting flashbacks.

permalink
report
parent
reply
3 points
*

Ayyyy

permalink
report
parent
reply
70 points

These things are true if you build a SPA wrong. Believe it or not there are lots of ways to build server side rendered pages wrong too.

permalink
report
reply
8 points

Yeah this meme and the OP have no idea how to build an SPA.

permalink
report
parent
reply
29 points

I don’t know what the hell you’re interpreting into this 15-word-meme, but I do. I’m not saying all SPAs are shit, I’m saying far too many are. And “far too many” being more than one that I can think of. Even the Lemmy webpage breaks history caching.

permalink
report
parent
reply
2 points

I know what an SPA is, but I would be laughing so hard at this thread if I didn’t know what it meant.

“Yeah man. Dude doesn’t know his SPAs!”

Reminds me of that Saturday Night Live skit with the woodworkers comparing everything to working on the lathe.

permalink
report
parent
reply
-4 points

> implying there’s a “right way” to build an SPA.

permalink
report
parent
reply
13 points

There are a lot of standard practices like… using a router to load the content of your SPA according to the url.

permalink
report
parent
reply
-1 points
*

What I’m saying is, there’s no right way to build a thing that is inherently wrong.

permalink
report
parent
reply
4 points

There’s no one right way. Saying there are wrong ways doesn’t imply the existence of one right way, though.

permalink
report
parent
reply
45 points
27 points
5 points

better

no HTTPS

uh huh

permalink
report
parent
reply
12 points

You think your 13 megabyte parallax-ative home page

Is parallax still a thing? I feel like ginormous hero images are more popular atm.

permalink
report
parent
reply
20 points

motherfuckingwebsite is pretty old at this point. I remember seeing it on Reddit like 10 years ago. Parallax was all the rage back then, when we called “hero” images “jumbotrons” (because Bootstrap called it that, I think?)

permalink
report
parent
reply
9 points

Which was derived from those big as screens in sport stadiums or sport arenas. As it was over shadowing the actual stuff below.

permalink
report
parent
reply
44 points

As an elder developer… yea, we could use react to render complex web pages that erode expected functionality.

Or, like, I’m happy to just go back to server-side rendering… it’s surprisingly cheap to build and dead fucking simple.

permalink
report
reply
31 points

Elder developer here too, correctly making my SPAs has made my work significantly more efficient and maintainable now that my back end is basically a rest api and my front end requires very little network interaction after the initial load, which has been made pretty minimal.

permalink
report
parent
reply
1 point

I too have been doing this for years and I whole hearty agree with this comment.

For large complex sites, I ain’t never going back.

Actually even for simple sites I’m not sure I’ll go back.

permalink
report
parent
reply
1 point

If I ever have to do this again, I’ll scream.

<a href=“<?php echo “/about-us”;?>”>

permalink
report
parent
reply
6 points

Elder developer too, you can easily render react server side and statically. Once you remove state, react simply becomes pure functions that output jsx nodes, it’s also dead fucking simple, but gives the the possibility to add hydration and state later if you need it.

permalink
report
parent
reply
3 points

This is actually excellent advice for performance - you can bake the initial page data in!

permalink
report
parent
reply
2 points

I prefer just writing my html, js, css, as is, and then transpiling to pack it down, treeshake, hash, cache bust, CSP, etc etc.

The amount if headache, overhead, inversion of control, mess, and bloat involved in frameworks tends to make me spend way too much time on writing boilerplate.

template and slot exist now, and modern js can do most of the shit fancy libs used to.

There’s very little need for frameworks unless you meed a SUPER dynamic website that has tonnes of mutability.

The amount if times i see people load in like 3 frameworks and 10mb of bullshit and ten js files to make a fucking static form that doesn’t even do anything fancy is insane.

Just fucking write the like… 8 lines of normal code to populate the form, wtf? Why are we using routers at all, HTTP already exists and does that, why did we re-invent http?

Front-end devs need to spend less time installing npm packages to try and magically solve their issues and just learn how to actually write code, SMH.

permalink
report
parent
reply
-1 points

More Server side logic means more vulnerabilities on your end.

permalink
report
parent
reply
5 points

I’ve seen front ends that build queries that are blindly executed by the backend - I’ve seen GraphQL that allows the client to read arbitrary users’ passwords from the database - I’ve seen attack ships on fire off the shoulder of ori- whoops, wrong memory.

Anyways, you can create vulnerabilities anywhere using anything - imo more server side logic might mean more vulnerabilities on the server but it means less vulnerabilities overall.

permalink
report
parent
reply
1 point

Why does it mean less vulnerabilities overall?

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 6.4K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments