Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
hey mom its 420
May 12, 2007

Haystack posted:

Sorry nerds, HTMX means that the backend is the frontend now :dealwithit:
actually, react server components means that the frontend is the backend now :coolfish:

Adbot
ADBOT LOVES YOU

prom candy
Dec 16, 2005

Only I may dance

duck monster posted:

Can't you just drop in a component somewhere (I havent done Ruby in a long time, so I have no idea how turbo + stimulus works, I just remember that for a while rubys answer to SPA was some stupid library that just preloaded pages and broke things. Which is a shame, because other than its dreadful default ORM, rails is a lot of fun.)

Yes and I often imagine a world in which Rails figured out and heavily promoted an elegant way to do this in like 2017 and remained relevant. Imagine if Rails came up with islands of interactivity instead of Astro.

gbut
Mar 28, 2008

😤I put the UN🇺🇳 in 🎊FUN🎉


hey mom its 420 posted:

actually, react server components means that the frontend is the backend now :coolfish:

Did they fix the secrets leak in react server components? I kinda stopped using react and paying attention to it when that happened.

fsif
Jul 18, 2003

prom candy posted:

Yes and I often imagine a world in which Rails figured out and heavily promoted an elegant way to do this in like 2017 and remained relevant. Imagine if Rails came up with islands of interactivity instead of Astro.

Since you've been kind of the Astro guy here, wanted to run something by you, if you don't mind.

My agency's about to make one of those Awwward-y/FWA-y sites with lots of bells and whistles (page transitions, bespoke complex animations, WebGL, etc) and a developer on the team has been making a really big push for Astro. We've just been semi-burned by the app router on a big project so we're all kind of using this as an opportunity to try something new. The big selling point to him with Astro is that we could three fiber and drei as little React islands.

From my vantage point, the site we're making is going to be littered with JS in every corner. Components will need mounting/unmounting animations. We'll need (very simple) shared state between pages and I'm not certain View Transitions will be enough to achieve the transitions we might want between pages. Minimizing the JS bundle size is also something of a tertiary concern since we're going to be preloading large 3D assets before allowing the user to enter the experience. Anything SPA-y with Astro is opt-in, as far as I can tell.

But then lusion used Astro with their site and my arguments suddenly appear to have less credibility, heh. But what say you? Given your choice of literally any tech stack, would you still reach for Astro on a complex site that tows the line between website and full-on app/experience?

prom candy
Dec 16, 2005

Only I may dance

fsif posted:

Since you've been kind of the Astro guy here, wanted to run something by you, if you don't mind.

My agency's about to make one of those Awwward-y/FWA-y sites with lots of bells and whistles (page transitions, bespoke complex animations, WebGL, etc) and a developer on the team has been making a really big push for Astro. We've just been semi-burned by the app router on a big project so we're all kind of using this as an opportunity to try something new. The big selling point to him with Astro is that we could three fiber and drei as little React islands.

From my vantage point, the site we're making is going to be littered with JS in every corner. Components will need mounting/unmounting animations. We'll need (very simple) shared state between pages and I'm not certain View Transitions will be enough to achieve the transitions we might want between pages. Minimizing the JS bundle size is also something of a tertiary concern since we're going to be preloading large 3D assets before allowing the user to enter the experience. Anything SPA-y with Astro is opt-in, as far as I can tell.

But then lusion used Astro with their site and my arguments suddenly appear to have less credibility, heh. But what say you? Given your choice of literally any tech stack, would you still reach for Astro on a complex site that tows the line between website and full-on app/experience?

You can build anything with anything these days but I don't think I would pick Astro for what you're doing. If you don't need SSR/SEO and aren't worried so much about bundle sizes I would probably reach for a good old fashioned React+Vite SPA.

I'm surprised you guys are using app router at all. I'm not touching that for production for a long time. Server actions are still in alpha aren't they?

fsif
Jul 18, 2003

prom candy posted:

You can build anything with anything these days but I don't think I would pick Astro for what you're doing. If you don't need SSR/SEO and aren't worried so much about bundle sizes I would probably reach for a good old fashioned React+Vite SPA.

I'm surprised you guys are using app router at all. I'm not touching that for production for a long time. Server actions are still in alpha aren't they?

We do need the SEO, but I'm leaning toward SvelteKit or Nuxt. I'd also rather just use Next with the pages router.

It was a mistake to use the app router when we did though, IMO. We began development about a week after it was announced as "stable." The prevailing rationale at the time was that we were setting up a site for a company that has its own in-house dev team and we wanted to ensure that it was set up well for updates over the next several years. It looked like the beginning of Vercel phasing out the pages router. (And we didn't need server actions.)

But the rest of the React ecosystem (particularly three fiber and drei) weren't ready for server components and we obviously saw next to no advantage in using them since our sites are so loaded with client-side JS anyway.

prom candy
Dec 16, 2005

Only I may dance

fsif posted:

We do need the SEO, but I'm leaning toward SvelteKit or Nuxt. I'd also rather just use Next with the pages router.

SvelteKit rocks. I have no Vue experience and probably never will because I hate directives.

I'll adopt React Server Components when they get added to Remix.

hey mom its 420
May 12, 2007

gbut posted:

Did they fix the secrets leak in react server components? I kinda stopped using react and paying attention to it when that happened.
I don't think so. That one's kind of a stinker, yeah. I guess for now it's just best to create server actions in their own files. I wish they'd just make that required. Or at least add a lint rule for that.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Angular vs React in this day and age? I can't find a straight answer about this, because each camp is hailing itself to be the best thing ever. IT dept is kinda pushy about getting me to switch from React to Angular.

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender
Why would you care what your IT department thinks about what front-end webtech is used?

kedo
Nov 27, 2007

IT has opinions about everything when it comes to web dev, and they are mostly misinformed and wrong and should be ignored.

Macichne Leainig
Jul 26, 2012

by VG
They're both fine, use the one you're already familiar with IMHO. And definitely don't change it at the behest of IT??

lunar detritus
May 6, 2009


Switch to Vue instead :hmmyes:

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Combat Pretzel posted:

Angular vs React in this day and age? I can't find a straight answer about this, because each camp is hailing itself to be the best thing ever. IT dept is kinda pushy about getting me to switch from React to Angular.

switch as in do new projects in angular, or port existing code from react to angular? i've never heard of anyone porting between one to another, i thought all web devs just make new projects if they got tired of the old ones.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!

minato posted:

Why would you care what your IT department thinks about what front-end webtech is used?
Because they're being whiny about me sitting in a department doing its own development work adjacent to them, and oh what would happen if I were to quit (or break my neck). As in "we don't have anyone that can do React".

--edit: I mean, a while ago we already had a similar discussion about me using Node.JS, with what them being an IBM i shop and writing their backend in RPG, served as web service via some IBM middleware poo poo. I stood my ground here.

Bruegels Fuckbooks posted:

switch as in do new projects in angular, or port existing code from react to angular? i've never heard of anyone porting between one to another, i thought all web devs just make new projects if they got tired of the old ones.
New stuff on Angular and maybe port my current ongoing thing, which isn't really anywhere far.

lunar detritus posted:

Switch to Vue instead :hmmyes:
They're already being dramatic about me having chosen React. From what I gather currently the most popular UI library/ecosystem.

Combat Pretzel fucked around with this message at 17:31 on Oct 6, 2023

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

Combat Pretzel posted:

Because they're being whiny about me sitting in a department doing its own development work adjacent to them, and oh what would happen if I were to quit (or break my neck). As in "we don't have anyone that can do React".

Are they under the impression that all new web "frameworks" are as difficult to learn as angular is? Do they not have anyone in their department who wants to become marketable by learning "new" (read, literally decade old) web technology?

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!

Bruegels Fuckbooks posted:

Are they under the impression that all new web "frameworks" are as difficult to learn as angular is? Do they not have anyone in their department who wants to become marketable by learning "new" (read, literally decade old) web technology?
There's some newly appointed lead, and he's being like every new thing opens a new can of worms. And they'd rather not if they don't need to, because said new guy is all about security. I can understand that part, and while the current codebase of theirs appears to be a clusterfuck (the non-web stuff anyway, some old devs didn't document it properly, and a lot of things are written in something called Synon / C2AE, which is :psypop:), I think he's overshooting the target a bit.

I prodded at Angular a bit today. It looks okay-ish in the first experiments. But I'd rather not switch, if it's actually dieing off.

Combat Pretzel fucked around with this message at 17:55 on Oct 6, 2023

prom candy
Dec 16, 2005

Only I may dance
Switching to Angular will be bad for your career and you should do everything you can to avoid it. React is far and away the incumbent. Angular lost.

Ima Computer
Oct 28, 2007

Stop all the downloading!

Help computer.

Combat Pretzel posted:

Because they're being whiny about me sitting in a department doing its own development work adjacent to them, and oh what would happen if I were to quit (or break my neck)
If you get hit by a bus, the talent pool for hiring React developers is significantly larger. :shrug:

Macichne Leainig
Jul 26, 2012

by VG
If he can’t articulate what it is about React that is inherently insecure compared to Angular (and this is the first I’ve heard anything like that) then :sever:

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!
Does IT just have some negative Meta/Facebook bias?

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Definitely a hard bias against Microsoft. To then say that they're getting Hyper-V hosts to run Docker containers. And tell me my preliminary VM to host my Node.JS poo poo would be Windows Server based, until they have competencies in regards to Linux (i.e. new hires).

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
angular being a microsoft product literally doesn't matter tell them to stfu

the app should be running in docker in production regardless, the environment shouldn't matter if they're the ones deploying it and they're doing it in a modern way

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Huh, I thought Google created it?

Macichne Leainig
Jul 26, 2012

by VG
If they are setting up infra for Docker containers why are they running your web apps in a Windows Server VM?

Half the point of using Docker (and JavaScript web apps I guess to some extent) is abstracting away the stupid OS idiosyncrasies

With all due respect, what in the absolute gently caress is going on with your IT department

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
google, microsoft. whatever!

prom candy
Dec 16, 2005

Only I may dance
Typescript is Microsoft

hey mom its 420
May 12, 2007

Angular is good if you're looking forward to 2014.

Yeah, I don't understand the hate for React and JS by self-professed backend developers. It's almost always based on pure emotions. It's been the most popular view library for 10 years or something and while it's transitioned to functional components, hooks and SSR, I think you can still use the old style class components and lifecycle methods perfectly fine. Meanwhile Vue and Angular have had harrowing transitions which pretty much required you to rewrite your whole app in one go, and I wouldn't trust them not to try the same poo poo again. It's not perfect, but it's surprisingly easy to create a react app that just works nowadays.

But the differences between Vue/Svelte/React/Angular aren't really that big or that important imo. What I think is more important is to use TS with strict mode, give tailwind a shot, and if you can, use something like tRPC or ts-rest; when you have a web app, I think it's a complete waste of time to hand-roll your own REST API for it. Like what if instead of just calling a function you had to think of a RESTful path for your endpoint, decide on the http method to use, write all the boilerplate for it and create a serializer and a deserializer and maybe deal with some query params and headers to boot. And then, if you want TS support for those endpoints on your front-end, you have to generate an OpenAPI schema or something and hook up a codegen tool to generate types and fetch functions (you also have to hook it up to your CI or run it manually, in which case everyone forgets all the time).

Sorry for the long-winded rant, I'm knee deep in web dev lately and have an axe to grind. hope someone finds this helpful

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!

Macichne Leainig posted:

With all due respect, what in the absolute gently caress is going on with your IT department
The gently caress I know. There's a whole lot of poo poo I could rant about. And did so in the past in various other threads in this subforum. I think the best recent one was one of the guys in the department I'm doing the planning for, asked me to set up a network drive, because our IT department couldn't manage (probably by them attempting some harebrained account-specific solution via GPOs, which was ridiculous, because said system was pretty much single user... which is the explanation I made up in my mind).

Seriously, reading back some of these rants in the past about this company, it feels like I was posting on shrooms or some poo poo, but I'm not even joking.

I've slipped into my current mixed position of production planning and data analyst because of random happenstance and some computer knowledge coming from my hobbies. And I feel like I'm being gaslit every time I deal with them. But since job hopping isn't so much a thing where in Europe as it is in the US, combined with the lack of sufficient paperwork (i.e. diplomas ans poo poo) that they tend to insist on around these parts, I have to stick to this for a while.

Combat Pretzel fucked around with this message at 11:50 on Oct 7, 2023

huhu
Feb 24, 2006
I'm trying to implement react-beautiful-dnd. It's almost there except for the fact that there's the slightest flicker before things update. Any advice on where to look next, I'm not quite sure what to google?

https://imgur.com/a/kEZKW8A

It appears that my video recorder won't pick up the flickering so I guess I need to describe it.

1. I have two items in a list [A, B]
2. I drag B to be before A
3. I let go of B.
4. B animates to where it should be in the sort order and pushes A down.
5. It shows [B, A] for a brief moment
5. For a brief moment, the screen flickers [A, B]
6. Everything is sorted and displayed correctly as [A, B]

huhu fucked around with this message at 00:26 on Oct 10, 2023

N.Z.'s Champion
Jun 8, 2003

Yam Slacker
Could be a performance problem rerendering the whole list. See this blog on React devtool's support for showing rerenders

To reduce rerenders you'd usually memoize the reactdnd item, and make sure each item doesn't depend on frequently changing state (global or local).

Ihmemies
Oct 6, 2012

I have not done such things, but they surely can't be harder than making GUI apps with C++/Java and QT/JavaFX...

So I installed angular on my server, and created a project. The tsconfig.json was lacking in some aspects, so I added in a few more configuration variables. Will I hate myself for this?

code:
  "compilerOptions": {
    // strictness
    "allowUnreachableCode": false,
    "allowUnusedLabels": false,
    "alwaysStrict": true,
    "exactOptionalPropertyTypes": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitAny": true,
    "noImplicitOverride": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noPropertyAccessFromIndexSignature": true,
    "noUncheckedIndexedAccess": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true, 
    "strict": true,
    "strictBindCallApply": true,
    "strictFunctionTypes": true,
    "strictNullChecks": true,
    "strictPropertyInitialization": true,
    "useUnknownInCatchVariables": true,
// etc...
I wanted to try out some Trypescript. I don't want to re-invent the wheel, so I thought Angular might offer some features I'd have to re-code otherwise from scratch. Pure Node.js will be enough of an server for now, I'll just make it return some dummy data in proto phase. Express add-on chiefly seems to support legacy HTTP/1.1 from TYOOL 1997 so that's a big no, no nonono.

Anyways, I'm hoping I can use typescript for the front- and backend, because Javascript is.. not... optimal. My brains start to hurt after trying to do something with it after a while. I want to make a personal web app for my own use, which displays weather information in a format I like.

We've made a few desktop apps which pull data over API, I'd reuse a weather api I've used earlier, so fetching and parsing data should not be a big deal.

How good/bad an idea Angular&node.js SPA with strictest typescript is?

hey mom its 420
May 12, 2007

I'd say that not using TS in any kind of web dev project is a bad idea. It's always great to start super strict and then you can relax it up a bit if you want, but usually you won't even have to do that.

If you have control over the back-end, you can try something like tRPC or ts-rest to get type-safe API calls for pretty much no hassle.

HaB
Jan 5, 2001

What are the odds?

hey mom its 420 posted:

I'd say that not using TS in any kind of web dev project is a bad idea. It's always great to start super strict and then you can relax it up a bit if you want, but usually you won't even have to do that.

If you have control over the back-end, you can try something like tRPC or ts-rest to get type-safe API calls for pretty much no hassle.

As a counterpoint, I do the exact opposite of starting strict. I start as js, not ts, then when basic functionality is working I rename to ts, and do my typing then.

I code kind of seat of my pants and things are constantly shifting for the first part of something new and I don’t want typescript constantly yelling at me while I’m just tryna get the idea working.

I don’t know what my types are yet, so I refuse to argue with ts over the types until I do know.

Ima Computer
Oct 28, 2007

Stop all the downloading!

Help computer.

HaB posted:

I code kind of seat of my pants and things are constantly shifting for the first part of something new and I don’t want typescript constantly yelling at me while I’m just tryna get the idea working.

I don’t know what my types are yet, so I refuse to argue with ts over the types until I do know.

This is one of the scenarios where I actually find Typescript to be super helpful.

When code is in a fluid state and shifting around a lot or I'm making large refactors, having types there to provide guardrails makes it a hell of a lot easier to move and change the code around without causing unexpected side-effects. Every time my types change, I'm alerted by the Typescript compiler to anywhere where an old version of the type is still expected.

prom candy
Dec 16, 2005

Only I may dance
I like using esbuild (or any build tool that just removes the typescript) because not only is it super fast, it also means you can run your code while it has type errors. That way you're free to ignore the compiler when you're hacking on stuff but you still get all the hinting in your editor and you can add typechecking to your process whenever you're ready.

hey mom its 420
May 12, 2007

HaB posted:

As a counterpoint, I do the exact opposite of starting strict. I start as js, not ts, then when basic functionality is working I rename to ts, and do my typing then.

I code kind of seat of my pants and things are constantly shifting for the first part of something new and I don’t want typescript constantly yelling at me while I’m just tryna get the idea working.

I don’t know what my types are yet, so I refuse to argue with ts over the types until I do know.

That's cool too, and I think largely a matter of personal preference.

My preference is more in line with Ima Computer. I like starting out by defining all my data structures and seeing if they make sense, which is where types are very useful. And then when I'm implementing functions and moving them around, it's much easy to change my approach and refactor stuff because the type system will tell me what I need to fix to make the change. Otherwise, I find myself spending a lot of time just searching for pieces of code where my assumptions don't work anymore instead of having the compiler tell me that.

Also, I think going from more strict to less strict is easier than the other way around.

smackfu
Jun 7, 2004

The trick is not getting caught up in a type error and wasting time trying to figure out what magic incantation it wants.

Roadie
Jun 30, 2013

Combat Pretzel posted:

Angular vs React in this day and age? I can't find a straight answer about this, because each camp is hailing itself to be the best thing ever. IT dept is kinda pushy about getting me to switch from React to Angular.

Angular (whether original or the redesigned v2-and-onward variety) was fundamentally designed for the pre-Webpack era when your build process was "concatenate all the files together and minify the result". Because of this, a significant majority of what it does is just a separate set of mechanisms for doing things that tooling you're using anyway already handles, like handling global state, dependency injection, template parsing, etc.

Vue is conceptually very similar to parts of Angular (two-way bindings, directives, etc), but without all the extra boilerplate that's just part of the build process now. Vue even has some of the same nonsense choices like reinventing JS syntax for filters/pipes.

smackfu posted:

The trick is not getting caught up in a type error and wasting time trying to figure out what magic incantation it wants.

If you're working with your own design and not some outside system, even having non-obvious type errors means you're probably doing something wrong.

Roadie fucked around with this message at 01:50 on Oct 16, 2023

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Combat Pretzel posted:

The gently caress I know. There's a whole lot of poo poo I could rant about. And did so in the past in various other threads in this subforum. I think the best recent one was one of the guys in the department I'm doing the planning for, asked me to set up a network drive, because our IT department couldn't manage (probably by them attempting some harebrained account-specific solution via GPOs, which was ridiculous, because said system was pretty much single user... which is the explanation I made up in my mind).

Seriously, reading back some of these rants in the past about this company, it feels like I was posting on shrooms or some poo poo, but I'm not even joking.

I've slipped into my current mixed position of production planning and data analyst because of random happenstance and some computer knowledge coming from my hobbies. And I feel like I'm being gaslit every time I deal with them. But since job hopping isn't so much a thing where in Europe as it is in the US, combined with the lack of sufficient paperwork (i.e. diplomas ans poo poo) that they tend to insist on around these parts, I have to stick to this for a while.

This is a pretty universal experience. Theres a *lot* of whackness out there in the land of corporate IT.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply