4 ms·
It's because when you build a SPA you give up a bunch of stuff that comes with the traditional web page model, and it's stuff that most teams overlook until it'
by safety1st 2y ago
It's because when you build a SPA you give up a bunch of stuff that comes with the traditional web page model, and it's stuff that most teams overlook until it's too late. They are usually fixated on a certain set of performance issues that drove them to do an SPA in the first place, their energy goes into that, and then they kind of look around at all the other stuff and go, oh, we don't have time for those things.
This is why I typically fight SPAs every step of the way with our clients, if any other architecture will work I see if there is a good case to be made for it, because I know that SPAs are usually going to end up shipping broken in some way.
- ervine 2y agoWhat kind of stuff do you give up with an SPA?
- nurettin 2y agoYou give up server redirects and cookie auth. (well you don't lose cookie auth, but you need extra steps for it to prevent CSRF)
- stackghost 2y agoYou can just have the server return a json object instructing the frontend to navigate, accomplishing server redirects.
- ftmch 2y agoJavascript can do browser redirects, but those are not actual 301 HTTP redirects.
- stackghost 2y agoYes, what I'm saying is that you can have the backend return e.g. "{ "response": 301, "redirectUrl": "https://example.com https://example.com" }", and then have the frontend handle that properly, and you get the functional equivalent. I'm aware that it is different under the hood.