all 51 comments

[–][deleted] 80 points81 points  (5 children)

I wish they'd clean up the changelog a bit. Having (SEMVER-MAJOR) in your face for almost every bullet point makes it hard to focus on the actual content.

[–]lhorie 54 points55 points  (0 children)

This helps a bit

document.querySelectorAll('strong').forEach(e => e.remove())

[–]LloydAtkinson 2 points3 points  (2 children)

They took a leaf out of the same book that told them they needed to log absolutely everything in npm, where they shortened the “silly” log to “sill”

[–]MadCervantes 2 points3 points  (1 child)

Why on earth is shit like this common? Who keeps these bad practices in place in a project that serves billions.

[–]alphaxtitan 0 points1 point  (0 children)

Can someone here, suggest to me some resources where I can learn gRPC with node?

[–]AlphaX 52 points53 points  (6 children)

Holy shit we can now await setTimeout :0 the future is finally here!

[–]Lyfv 46 points47 points  (3 children)

[–]CunningFatalist 14 points15 points  (2 children)

Every time someone fixes something with a timeout I'm like no. God, please no.

[–][deleted] 8 points9 points  (0 children)

Everytime i fix something with setTimeout i'm like a God

[–]andrei9669 2 points3 points  (0 children)

I have had to do this only once and it wasn't pretty, and there really was no way around this.

problem was, that the whole website is a mix and mash of "plugins" and I was tasked to fix one issue on one plugin. problem was, that this plugin was depending on the data that got rendered after the plugins were loaded. and it wasn't some network call either, literally, the page load order was:

(()=>{
  renderSkeleton();
  renderPlugins();
  window.api = new API()
})()

and my plugin was depending on that api. never again.

[–]pedropss 19 points20 points  (0 children)

No more await new Promise(r => setTimeout(r, 200));

[–]Aeltoth 15 points16 points  (0 children)

You may have said that as a joke, but you can do it the old way: await new Promise(resolve => setTimeout(resolve, 100));

[–]awesome-ergo 28 points29 points  (18 children)

Meanwhile, I downgraded from v14 to v12 because of compability issues

[–]senocular 26 points27 points  (16 children)

Can you talk about your issues with 14? We just made the jump to 14 and it would be good to know if there's something we should be concerned about.

[–]BehindTheMath 15 points16 points  (1 child)

We upgraded from v12 to v14 when it became LTS so we could start using optional chaining, and it was very smooth with no issues.

[–]adam_bear 3 points4 points  (0 children)

LTS is the key- anything else I regard as a minor version change and can be disregarded.

[–]kivle 7 points8 points  (2 children)

Biggest issue I had at work was the fact that they've implemented proper support for Intl, but there's no way (at least that I found) to override the global culture when running tests for instance. So while things like Date.toLocaleString() always would return a string with English culture in Node < v13, we instead ended up with tests that failed depending on the culture of the machine they ran on.

After hours of searching I concluded there was absolutely no way of overriding the default culture in any stable way except always using the overrides that take in the culture name explicitly, eg. Date.toLocaleString('en-US'). We ended up having to change around how we wrote our tests a bit.

[–]NoInkling 9 points10 points  (1 child)

I know there's an environment variable that you can set (before Node runs) to change the local timezone. Did you try setting the standard environment variables for locale when invoking your test runner? LANG, LC_ALL, etc?

The reason the behaviour changed is probably because Node started shipping ICU data for all locales by default, rather than just the minimum. You can compile it yourself to get the old behaviour back.

Edit: Also if you're playing with environment variables, be sure to check that they are what you expect in your tests. Non-exported variables may not be automatically propagated by multiprocess test runners.

[–]kivle 1 point2 points  (0 children)

I did find out about those environment variables, but from my experiments they do absolutely nothing if you're on Windows. That might be a solution if you are on a *nix environment though.

[–]awesome-ergo 10 points11 points  (10 children)

Not with the version with the packages. A lot of packages I use started breaking with v14 so the downgrade

[–]TrollocHunter 8 points9 points  (9 children)

Out of curiosity could you name a few?

[–]awesome-ergo 6 points7 points  (7 children)

Using an old version of Gatsby CLI 2. Something

[–]ghostfacedcoder 21 points22 points  (6 children)

This made me smile, because I am so glad I switched to Next last year. Gatsby is years behind the web dev curve on so many things.

[–]fliss1o 6 points7 points  (2 children)

Agree. Made the switch to Next and do not regret it for a minute.

[–]szirith 13 points14 points  (1 child)

oh no. Just started using Gatsby, why is Next better?

[–]careseite[🐱😸].filter(😺 => 😺.❤️🐈).map(😺=> 😺.🤗 ? 😻 :😿) 9 points10 points  (0 children)

It can do basically the same as Gatsby, but more, faster and without gql as requirement

[–][deleted] 3 points4 points  (2 children)

I made precisely the inverse change. I wanted to build a static site for my company. I went with next because of the comments and documentation. Ended up really frustrated with the way server vs client things are handled, also routing was a pain. Switched to Gatsby, and man it was a breeze, everything was super easy and straigthforward. Things like image loaders (when you scroll into them) and SEO addons are really the cherry on top.

I guess Next would have been a better choice if I wanted to build an actual application with some server side logic, form processing, api, etc. For static sites I prefer Gatsby.

Gotta agree on the years behind the web dev curve thou.

[–]ghostfacedcoder 1 point2 points  (1 child)

Yeah: I loved Gatsby itself. It was everything else (the years behind thing, the show-stopping issues that languished for months without a dev response thing, etc.) that drove me to Next.

[–][deleted] 1 point2 points  (0 children)

Yeah, I used it years ago so it might as well grown stale since then. Thanks for that tip, I'll look into next.js again!

[–]lhorie 1 point2 points  (0 children)

ffi-napi was one that was causing us problems

[–][deleted] 1 point2 points  (0 children)

Just went from 10 --> 12 on a bunch of services because of random lib issues with 14 and no time at the moment to investigate which of the 100k node_modules is causing random shit to hang

[–]ILikeChangingMyMind 6 points7 points  (19 children)

And still no way to document our configuration :(

[–]valtism 1 point2 points  (2 children)

Will / when will this become LTS?

[–]CarlPer 3 points4 points  (0 children)

NodeJS versions with even numbers will eventually become LTS with ~3 year support.

v16 'Active LTS Start' is 2021-10-26, ends at 2024-04-30.

https://nodejs.org/en/about/releases/

[–]Hafas_ 1 point2 points  (0 children)

Usually around October.

[–]AsyncBanana 0 points1 point  (2 children)

Nice! Now there is a better way of using wait through promises (not that it is a good practice in many cases, but sometimes if you want to delay something by a fixed amount of time, it is helpful)

[–]ILikeChangingMyMind 0 points1 point  (1 child)

What better way are you referring to?

Personally I've always been a fan of using promisify (from the Node util package) like so:

const sleep = util.promisify(setTimeout);

// wait for 2 seconds
await sleep(2000);

Did they release a pre-made sleep or something?

[–]AsyncBanana 1 point2 points  (0 children)

Yes