Opens profile photo
Follow
Click to Follow NoriSte
Stefano Magni
@NoriSte
Passionate, positive-minded / Front-end Tech Leader (platform) / Speaker / Instructor / Author of UI Testing Best Practices / Remote worker
Lecco - Italygithub.com/NoriSteJoined April 2010

Stefano Magni’s Tweets

Pinned Tweet
New pinned tweet: interesting Autumn! 🧑‍🏫 I teach UI Testing best Practices for the 13th time 😱 🗣️ 2 talks for and 📄 I'll publish some articles for sure As usual, here is the list of the previous articles/talks/courses ❤️
2
Interesting commit message-related article. I discussed this approach with and in the past when said to me "your PR descriptions are great but they live on GitHub instead of the Git history..." (PR description article here: dev.to/noriste/suppor )
Quote Tweet
Replying to @AdamRackis @Swizec and @jody_lecompte
Really have to disagree here. I have a blog post that touches on that topic: tkdodo.eu/blog/avoiding- But I have to admit that I don't care as much anymore as I did when I wrote that article, because it's too hard to align a whole team on that. I still do it personally
1
1
Show this thread
Interesting, well-explained, and full-of-resources-linking article about callback refs and uncontrolled compound components 😊
Quote Tweet
🧵 React ref Callback Use–Cases - @Mega_Jules Great in-depth article about Compoonent callback refs DOM element side effects useRef() is not enough Ex: sometimes you want to trigger a rerender when ref is set, because you need to use element in render julesblom.com/writing/ref-ca
Show this thread
Image
1
Very interesting engineering productivity-related thread 😱
Quote Tweet
In the last 9 months, working with leaders in the @stripe Developer Productivity org, I advocated for and established a team and a measurement framework to understand and improve the software engineering experience at @stripe.
Show this thread
Uh, I forgot about this awesome utility!! Just installed it and yes, it's the coolest way to check a file's history!!
Quote Tweet
I forgot this tool exists but @pomber's "Git History" is probably still the most convenient way to check a file's history out there. githistory.xyz Video alt: Inspecting a file's history by using the keyboard to show file additions/deletions.
Show this thread
Embedded video
0:22
117.2K views
And while speaking about ESLint + TypeScript... here are some superb advice
Quote Tweet
Replying to @TkDodo @mattpocockuk and @tseslint
Hi hi 🥰! My biggest +1 for @tseslint is using the recommended-requiring-type-checking config -- and once you feel comfortable with that, the strict config. They have a lot of great stuff that @TkDodo mentioned! typescript-eslint.io/docs/linting/c
1
I like leveraging linters as much as possible to get less-ambiguous code. Here is a way to remove unnecessary conditions 😊
Quote Tweet
Replying to @mattpocockuk and @tseslint
no-unnecessary-condition is my favorite rule. E.g. if you refactor from required to optional, TypeScript will naturally tell you to add a check. But the other way around, it won't because it doesn't matter for correctness. But @tseslint does care about those unnecessary checks
1
A great, interactive, functional React component and hooks lifecycle timeline ❤️ You deserve to be proud of that, Jules!!
Quote Tweet
Proud to publish my latest blogpost: an interactive diagram showing how a React component with hooks run. It includes a quiz too with some tricky React Riddles to test your knowledge. Check it out julesblom.com/writing/react- #react
Show this thread
Embedded video
0:04
38.3K views
2
I love this super-simple and tree-shakable env/prod detection!!! 😱
Quote Tweet
this was built for SvelteKit, so that we can do things like import { DEV } from 'esm-env'; if (DEV) { do_expensive_validation(); } and it will be shaken out of client bundles, without any bundler configuration. but you can use it anywhere! twitter.com/puruvjdev/stat…
Just used for one of the following Hasura features to cast a convert an input field value into a numeric value 😊
Quote Tweet
z.coerce is a SUPER cool feature of the new Zod release. Lets you really easily parse search params into numbers/strings/booleans, and errors if they can't be coerced. Really nice.
Show this thread
Image
2
I partially forgot about Error's cause API 😊 I have just set it up before sending some error to Sentry 😊
Quote Tweet
Problem: You want to re-throw a JavaScript error to provide a friendlier error. But, you want to keep the original error details too. Solution: Include the original error via `cause`. More: developer.mozilla.org/en-US/docs/Web #javascript
Image
1
It's important to keep it in mind, especially when you have you deal with a high technical debt every day and prioritizing efforts could be hard. We are also reading other companies' Platform-related stories to gather useful feedback without reinventing everything 👇
1
Show this thread
In we are now split in Feature teams and one Platform team. The mindset transition requires time, either for the company and for us. As part of the Platform team, we need to be sure we prioritize our customer needs, and our customers are... Feature team's engineers! 👇
1
Show this thread
How to recreate a Flash Player from scratch to save your games... ❤️ I can recall the early years of my career working with ActionScript, then Starling and Adobe AIR... 😍 anyway, let's go back to the article, what Robin did s frigging cool 😱
Quote Tweet
I've written an article about the process of bringing Hapland Trilogy to Steam: foon.uk/how-flash-2022/ #gamedev
1
Does the API throw 10 exceptions, but 8 are prevented by the form validation? Type and manage only 2! You can leave a comment or type down the errors as `Error1 | Error2 | unknown` if you want to be sure the error management scales.
1
Show this thread
Does the API accept 10 things, but the UI needs 2? Type only 2! You can leave a comment in the code pointing to the server docs to look for more options, but do not write the types. You have to maintain them then!
1
1
Show this thread
If you have to write the TS types for your server APIs/DTOs because they are not provided... write ONLY the ones the UI needs! Typing only the part of the server consumed by the UI is more resilient and less tedious...
1
5
Show this thread
Loving it 😊 well done Joel and the whole team, the Process 🌀 rocks 😊
Quote Tweet
I wrote about The Process 🌀 we used if you'd like to read more details of the story badass.dev/launch-of-a-de
Show this thread
The whole thread is one of the lot of "React 18 strict mode ruins everything here" but I think it's a bit more interesting than the usual ones 😊
Quote Tweet
Replying to @aaronmcadam @leepowell and 2 others
I second the synchronization model. Before StrictMode I was often treating useEffect as declarative change detection. Now I've started to find events instead & my code has generally improved with fewer hard-to-follow useEffect chains + missing deps. e.g.
// 🚨 Change detection
const Component = ({ user }) => {
  const location = useLocation()
  useEffect(() => {
    window.analytics.track('page_view', location.pathname, { user })
  }, [location])
  return null
}

// ✅ Synchronization
const Component = ({ user }) => {
  const history = useHistory()
  useEffect(() => {
    const unlisten = history.listen(() => {
      window.analytics.track('page_view', location.pathname, { user })
    })
    return unlisten
  }, [history, user])
  return null
}
1
Sort-of Copilot for the terminal?!? 😱❤️
Quote Tweet
✨ Introducing `plz`, an AI-powered command generator. Kinda like copilot, but for your terminal. It's ideal for all those weird unix commands that take dozens of flags, and you never know which ones to use (like ffmpeg). (takes one command to setup 👇) github.com/m1guelpf/plz-c
Embedded video
0:49
57.9K views
3
I remember sharing a hypothetical new API for @xstate/react that allowed to keep the machine's context in sync with a React component state ... am I wrong? I'm doing this, but I am not sure that using events to update the context is the most idiomatic solution...
Image
2
2
Wow, type narrowing for the win!!!
Quote Tweet
const modifiers for type parameters are coming to TS 5.0, I had a feeling that this might happen soon loving, loving it ❤️ declare function bar<const T>(obj: T): T; bar([1, 'foo']) // readonly [1, 'foo'], and not (string | number)[] github.com/microsoft/Type
Show this thread
1
When you have a finite number of strings, this is extremely useful to keep type safety and improve the DX! Try it against a union of strings...
Image
Quote Tweet
Embedded video
1:58
🔥 TypeScript Tip 🔥 You can do string.replace in TypeScript! With the help of some recursion, infer and a whole bunch of template literals. typescriptlang.org/play?#code/C4T
2