Sungbin Jo

2.9K posts

Sungbin Jo banner
Sungbin Jo

Sungbin Jo

@goranmoomin

Programming on the web and on the Mac with Cocoa, AppKit, and Swift. An Emacs user. Profile image not me. @goranmoomin.dev on Bluesky

Seoul, South Korea Katılım Aralık 2018
161 Takip Edilen412 Takipçiler
Sabitlenmiş Tweet
Sungbin Jo
Sungbin Jo@goranmoomin·
I’ve recently restarted my (previously abandoned) HackerNews project – huge thanks to @collindonnell’s code review. I've just released v0.1.0, the first version that is “usable”. Still has a long way to go though. Please try it out! RTs appreciated. github.com/goranmoomin/Ha…
Sungbin Jo tweet media
English
0
4
16
0
Sungbin Jo retweetledi
Jihyeon Kim (김지현)
Jihyeon Kim (김지현)@simnalamburt·
Fast-forward merge for GitHub github.com/simnalamburt/f… GitHub has gone far too long without supporting fast-forward merge in the web UI, so I built it myself as a Chrome extension. Give it a try!
Jihyeon Kim (김지현) tweet mediaJihyeon Kim (김지현) tweet media
English
0
15
44
6K
Sungbin Jo
Sungbin Jo@goranmoomin·
This is a lot more annoying when done on API documentation. Looking at Google…
English
0
0
1
42
Sungbin Jo
Sungbin Jo@goranmoomin·
One thing I can't get over with a lot of corporate blog posts is how a lot of them are LLM-translated, and then they show the translated one, with no clear button to switch to the original one. Reading the article it's pretty obvious that they don't review the translate…
English
1
0
1
113
Sungbin Jo
Sungbin Jo@goranmoomin·
@jeremyphoward @mitchellh That’s probably a macOS thing, I had the same experience in Terminal.app. It’s due to the macOS kernel only providing a tiny (1024 chars) buffer to the tty for default cooked mode. That’s why if you paste text with no new lines, it gets truncated after 1024 chars.
English
1
0
0
21
Jeremy Howard
Jeremy Howard@jeremyphoward·
Anyone using Wezterm? I've been having quite a few issues with Ghostty recently (particularly with trying to paste more then a few lines of text in—it often truncates) so wondering about trying something else. I've used alacritty before, and liked it. wezterm.org
English
54
1
125
46K
Sungbin Jo
Sungbin Jo@goranmoomin·
@dai_shi @TkDodo Would creating an issue in the Zustand repo actually find out a good API for this, or nah? I did notice that for Jotaiv2, there seems to be a provided AbortController that seems to prevent these scenarios: #advanced-api" target="_blank" rel="nofollow noopener">jotai.org/docs/core/atom…
English
2
0
1
84
Daishi Kato
Daishi Kato@dai_shi·
@goranmoomin @TkDodo It might not be the real solution, but you can store a promise value itself. (and use `use` to consume) store = create((set) => ({ v: Promise.resolve(0), action: (a) => { set({ v: f(a) }); })
English
2
0
1
74
Sungbin Jo
Sungbin Jo@goranmoomin·
I'm trying to figure out race conditions in async actions when using Zustand… So i.e. if I have an async action that does async things before setting the store, when calling the same actions twice, the first might actually take more time than the second and set a wrong value.
English
3
0
1
313
Sungbin Jo
Sungbin Jo@goranmoomin·
@dai_shi @TkDodo Ouch would that mean that there's not really a *clean* solution for React <=18 for now?
English
1
0
1
62
Sungbin Jo
Sungbin Jo@goranmoomin·
@TkDodo @dai_shi @tan_stack For example… if you're doing web workers and you're getting asynchronous responses. (I guess one might probably able to bend over react query to actually handle it, but i'd rather not) ;)
English
1
0
1
38
Sungbin Jo
Sungbin Jo@goranmoomin·
@TkDodo @dai_shi @tan_stack I'm very grateful of react query and using it heavily, it's just that there's some kinds of async actions that aren't really data fetching… but still basically has the same problem.
English
1
0
1
54
Sungbin Jo
Sungbin Jo@goranmoomin·
Tagging people who might know *the* solution: @dai_shi @TkDodo (sry for the noise…)
English
2
0
2
169
Sungbin Jo
Sungbin Jo@goranmoomin·
i.e. if we have a store = create((set) => ({ v: 0, action: (a) => { let v = await f(a); set({ v }); }) and we do action(a1) and action(a2), then depending how much await f(a) takes, v might be set as f(a1) instead of f(a2). I'd like to prevent this, how should I do that?
English
1
0
1
187
Sungbin Jo retweetledi
Mitchell Hashimoto
Mitchell Hashimoto@mitchellh·
When Ghostty detects a password input prompt, it now changes the cursor to a lock and on macOS enables the secure input API. When the secure input API is enabled, we show a neat, animated icon that explains what's going on when clicked. Another example of native UI wins (imo). Secure Input is the macOS system API that prevents accessibility APIs from reading your keystrokes, so things like screen recording software and so on can't read your passwords. Other terminals on macOS support secure input. I think only iTerm also supports secure input on password detection. So as a disclaimer, I'm not trying to claim this as a huge innovation, I just think our implementation is nice. 😊
English
23
23
724
81.6K
Sungbin Jo
Sungbin Jo@goranmoomin·
@TkDodo Yeah maybe. I might just have too much resistance on creating new components and go the easy way. (I personally feel that if you have a lot of components 'for the same thing', it's harder to make the logic for that thing 'local')
English
0
0
1
27
Dominik 🔮
Dominik 🔮@TkDodo·
@goranmoomin If that's the case, you have another natural splitting point for your component composition: the hooks + jsx after the early return should likely become their own component.
English
1
0
0
41
Dominik 🔮
Dominik 🔮@TkDodo·
I was a bit vague, so here is a better example. There's an obvious bug in here: When you're pending, you also have no data, so you'll render the empty screen right away with the spinner. The condition needs to be !data && !isPending. Gross. Also, all conditions we add in the future must check each branch. I've seen those components evolve into huge monsters a lot, but also this rather simple flow is already hard to grasp. It's not clear to me what actually gets rendered in each "state". Cognitive load is what matters (great read btw: github.com/zakirullin/cog…) So why did we add those conditions in the first place? Well, because they all share the div and the Heading and the Card with the same styles. If that becomes it's own layout component, things will be much easier to read, because we can then use early returns: We mostly don't care about the layouting jsx, it's boilerplate, so move it away from the logic. This version doesn't have the bug. Also notice how TypeScript now helps us with type inference. Because we have returned with !data, it now knows that data is defined afterwards. If it's easier to grap for the compiler (which is pretty smart), it's surely also easier for humans to understand.
Dominik 🔮 tweet mediaDominik 🔮 tweet media
Dominik 🔮@TkDodo

conditional renderings in react (no matter if you do them with && or with ? : null) don't evolve well. Like: { isPending && <Spinner /> } more conditions will follow, and you'll end up having a spinner where you don't want it. The solution is almost always component composition

English
28
26
507
93K
Sungbin Jo
Sungbin Jo@goranmoomin·
@TkDodo So at that point you’re forced to have all of those returns at the end, and so you get a bunch of logic between your data fetching logic and your returns… And at that point I feel like this starts to matter less (bc most of the complex code isn’t in JSX, but the logic above.)
English
1
0
1
31
Sungbin Jo
Sungbin Jo@goranmoomin·
@TkDodo I’ve always avoided early returns in React because I felt it doesn’t work well with hooks. If you call a hook between one of the returns, that becomes an error right (due to the rules of hooks)?
English
1
0
1
49