Sandro's Avatar

Sandro

@sandroroth.com.bsky.social

Software Developer based in Switzerland πŸ‡¨πŸ‡­ πŸ”— sandroroth.com πŸ”— tinytip.co

22 Followers  |  29 Following  |  24 Posts  |  Joined: 02.11.2024  |  2.2596

Latest posts by sandroroth.com on Bluesky

Lucky you - we use a component library that often re-creates DOM elements when unstable values or callbacks are passed in πŸ€·β€β™‚οΈ 😒

28.07.2025 18:36 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Isn't that expected as Recoil is no longer maintained?

19.07.2025 13:58 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

> Reproduction: I'm not lying

πŸ˜‚

14.07.2025 15:56 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
two men are sitting at a table eating food in a restaurant . ALT: two men are sitting at a table eating food in a restaurant .
30.06.2025 19:43 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
Kill the Newsletter! Convert email newsletters into Atom feeds

I don't have many email newsletters and just keep them in Readwise Reader. What's your workflow? Maybe you can use Kill the Newsletter.

07.06.2025 08:05 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Here we go πŸ₯³

25.05.2025 18:11 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Post image

Finally found a way to archive interesting blog posts.

From RSS into Readwise Reader β†’ Download via Reader API β†’ Extract content as Markdown β†’ Create Markdown file with Frontmatter β†’ Move into Obsidian Vault β†’ Create table with Obsidian Base πŸš€

25.05.2025 18:10 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 0    πŸ“Œ 1

I'm struggling a lot with that πŸ€” I use Readwise for RSS and email, but it’s not great for code-heavy articles or long-term bookmarking. Raindrop is good for bookmarks but lacks RSS/email. Obsidian + Clipper sounds nice for archiving, but syncing from Readwise is manual (and I'm lazy).

23.05.2025 19:56 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

You can already display properties 🀨

22.05.2025 18:02 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Nice setup πŸ‘ We use Vitest + happy-dom but we'll evaluate Vitest's browser mode when it's stable.

We have units tests for transition-heavy machines that are not fully covered by UI tests. UI tests give as much more confidence, they test everything together (just API request are mocked).

02.05.2025 04:27 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0

Then you don't test the UI components?

01.05.2025 20:23 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

> [...] to validate my machines

Do you test your machines directly? I sometimes write test for the machine itself but mostly prefer to test the UI and treat the machine as an implementation detail.

And the UI doesn't even have to be implemented as a state machine for model-based testing.

01.05.2025 18:58 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I still need to learn more about how to model the machine for model-based testing, I think it's harder than modelling a machine for the app itself.

@davidkpiano.bsky.social Maybe something for your next talk πŸ˜‰

01.05.2025 18:58 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I think Model-based testing is helpful if there are many UI states and interactions. Writing tests manually for all the possible transitions is a lot of work and it's easy to overlook some paths.

01.05.2025 18:58 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I just used Model-based testing for the first time. It's in a small side-projection and traditional tests would actually work fine for this use case. I'm still waiting for a good use case to come up at work.

01.05.2025 18:58 β€” πŸ‘ 1    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

I could be wrong but I think it happens if the promise resolves in less than 300ms (min duration for Suspense AFAIK) and the sibling component is updated after the promise resolved but before the 300ms are reached.

01.05.2025 18:33 β€” πŸ‘ 4    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0

Interesting, I just have 3 snapshots (not 4) with the Body only being rendered once ("This is the first time the component rendered"), but render count is 2.

It's also reproducible with just `use(someStaticPromise)` without a query, so it's not doesn't seem to be related to uSES.

01.05.2025 18:33 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Video thumbnail

Model-based testing with XState helps you test your app more thoroughly without writing every test by hand. You define the model, add test code for states and events, and XState generates the rest. Here, I’m running over 60 tests from just one model. πŸš€

#testing #xstate #statemachine

27.04.2025 17:05 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Post image

Not that bad πŸ˜‡ but I'm unsure if it's a good idea, as plain HTML introduces other issues, such as overly long text lines that hinder readability πŸ€”

28.03.2025 19:56 β€” πŸ‘ 0    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
Preview
Use valid CSS selectors in useId format by sebmarkbage Β· Pull Request #32001 Β· facebook/react For the useId algorithm we used colon : before and after. #23360 This avoids collisions in general by using an unusual characters. It also avoids collisions when concatenated with some other ID. Un...

It should not be needed in upcoming versions: github.com/facebook/rea...

25.03.2025 12:25 β€” πŸ‘ 5    πŸ” 0    πŸ’¬ 1    πŸ“Œ 0
CSS Selectors Playground

My interactive playground for CSS selectors now uses @tanstack.com Start + Router. I also redesigned the homepage and added a few more selectors.

Do you miss a selector?

#css #react #tanstack

16.03.2025 08:45 β€” πŸ‘ 7    πŸ” 2    πŸ’¬ 1    πŸ“Œ 0

- Integration of other libs/state like a router.
- Simplify machines with many transitions (e.g. wizards, users can nav back to any not skipped step until submit state). Not sure how this could look like.
- Derived context/selectors
- Better type-safety
- Tell Copilot that v5 was released

19.12.2024 08:36 β€” πŸ‘ 3    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
A Visual Studio Code screenshot showing a TypeScript code snippet for defining German translations. The cursor is positioned at the value of the translation key "sidebar.navItemToggle.label," and an autocomplete popover suggests the default English translation "Toggle {{ title }}" as a possible value.

A Visual Studio Code screenshot showing a TypeScript code snippet for defining German translations. The cursor is positioned at the value of the translation key "sidebar.navItemToggle.label," and an autocomplete popover suggests the default English translation "Toggle {{ title }}" as a possible value.

Using string union types for handling translations not only autocompletes the keys but also provides their default English translations. This helps you understand what to translate and identifies available dynamic values. TypeScript is incredibly powerful! πŸš€

#TypeScript #i18n

01.12.2024 09:10 β€” πŸ‘ 2    πŸ” 0    πŸ’¬ 0    πŸ“Œ 0
```tsx
<!-- Approach 1: as prop -->
<Dialog.Close as={MyButton} variant="outlined">
  <Icon />
  <span>Close</span>
</Dialog.Close>


<!-- Approach 2: asChild prop (Radix UI) -->
<Dialog.Close asChild>
  <MyButton variant="outlined">
    <Icon />
    <span>Close</span>
  </MyButton>
</Dialog.Close>


<!-- Approach 3: render prop (Ariakit) -->
<Dialog.Close render={<MyButton variant="outlined" />}>
  <Icon />
  <span>Close</span>
</Dialog.Close>
```

```tsx <!-- Approach 1: as prop --> <Dialog.Close as={MyButton} variant="outlined"> <Icon /> <span>Close</span> </Dialog.Close> <!-- Approach 2: asChild prop (Radix UI) --> <Dialog.Close asChild> <MyButton variant="outlined"> <Icon /> <span>Close</span> </MyButton> </Dialog.Close> <!-- Approach 3: render prop (Ariakit) --> <Dialog.Close render={<MyButton variant="outlined" />}> <Icon /> <span>Close</span> </Dialog.Close> ```

React Component Composition with polymorphism is quite tricky. You loose type-safety and it's easy to break a11y.

The `as` prop is probably the worst (slow type checking + ambiguous props). `asChild` hurts readability and introduces additional nesting. Is @ariakit.org's `render` approach the best?

17.11.2024 19:12 β€” πŸ‘ 11    πŸ” 1    πŸ’¬ 0    πŸ“Œ 0

@sandroroth.com is following 20 prominent accounts