đź’ľ Archived View for seldoncortex.com captured on 2023-09-28 at 15:28:57. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-09-08)
➡️ Next capture (2023-11-04)
-=-=-=-=-=-=-
I recently worked on a combo-box component that originally was set up to use the provided `selectedKey` prop value on first render, but then to manage the key internally using the `useState` hook.
Managing the state completely internally after first render worked fine when the prop value wasn’t expected to change after first render. For example, if a new page was completely loaded with a new prop, that was fine, but when the page content was changed due to a React Router navigation (which didn’t cause a complete rerender of all components like a vanilla browser refresh would) then problems set in.
Essentially, I had to set up the combo-box component so that the `selectedKey` would be managed *internally* unless the prop input for `selectedKey` changed, when it would then set its internal `selectedKey` value to the prop value.
At first I tried just `setSelectedKey` just in the raw body of the component, but that resulted in the value of the selected key being reset to the input prop even when the input hadn’t changed because components rerender when their parent rerenders (unless they’re memoized of course).
So I put the `setSelectedKey` in the component inside a `useEffect` that triggers when the input prop value changes, and voilĂ , problem solved!
And here I am, a week later, not having engaged much with Korean. But I have been engaging with Toki Pona, and I am still hoping to work some more with Korean.
Toki Pona is used by people because they want to use the language. It is an end in itself, which is how language learning has been for me.
Trying to use French and Korean with native speakers organically has felt like punching bullet-proof glass. They have their own native world where they go about their lives, and an anglophone trying to break in for the sake of using the language is off putting. Maybe ve is novel, like an orangutan in clothing, but not worth engaging deeply with.
But there are few, if any at all, native speakers of Toki Pona. We use the language with one another because we enjoy using it. I have this burgeoning yearning for communities of language learners that use their target languages with one another, regardless of if they are conlangs or not. Maybe others have been satisfied by the welcome of native speakers and I am maladapted socially for organic langauge interaction with natives. Some might bemoan the risks of non-native input, but I feel such wind is nitpicking.
So, recently I have been engaging a bit with the Korean language again. I have a complicated relationship with Korean and language learning in general. I've spent a significant amount of hours striving towards fluency in languages, but have not reached it. Partially I haven't reached fluency because I have failed to focus on one. The language I grew closest to conversational fluency in was Korean.
Then I developed hypothyroidism, chronic leg pain, and moved to a new city in Korea and so did not have the friend base I had in the old city. I had a very bad third year in South Korea. At one low point, when my computer was having trouble loading a presentation right before my first class of the morning, I raked my nails across my face and drew a bit of blood. I can't quite remember but I believe I started to self-harm just a touch in other similar ways.
It's sort of ridiculous, isn't it? Wait, wasn't this post about language learning? Why are we talking about self-harm? Why didn't ve just go home, if it was so bad? I guess because we sign year long contracts as Teachers of English as a Foreign Language, I wanted to stick it out. I had already done two years, and I didn't want be a quitter, to give up? I should have gone home, I think. Or I should have really reached out to more people, but it was so hard. I had already learned that lesson at the end of my first year in Korea, that I needed people. And yet, I still let myself get so alone during that third year.
Anyway, I've gone through bouts of getting back into Korean and then dropping it since moving back stateside. I dream less frequently about speaking Korean again, but it still happens. I let a part of myself hibernate and it felt like letting part of myself wither away. But I always wanted friends whom I spoke Korean with.
My mom multiple times told me I was selfish for wanting friends whom I only spoke Korean with. Why didn't I want to share my native language? I personally felt driven by some of Benny the Irish Polyglot's thoughts on the subject. I travelled here to learn your language. If you want to learn English, **you** go to an English speaking country. That is selfish, but perhaps practical. Further, my own thoughts on the subject were that I am paid to teach English. If you want to pay me, that's fine. Thus, (in that way) I would gain more value by you paying me than by us exchanging languages or whatever.
I finally got her to see my point by giving a similar example to the following: Imagine a Ukrainian speaker moves to the United States to learn English. They move to a small midwestern town. They expect to be able to learn English here. They certainly don't expect to have to struggle to find people that aren't only interested in interacting with them because they themselves want to learn **Ukrainian.** But English is an international language. And maybe therefore it was foolish to want an immersive experience where I could make friends. Heck, I struggle at making friends in English, let alone a foreign language and culture.
I guess I'll stop here, for now.
Manually reposting this here from my https website:
I just fixed our Book Town project site that had been down for a couple months. It suddenly stopped working, and I will admit that I would have definitely fixed it faster if I hadn't already gotten my first dev job. But another member of my team for the project reached out to me about it and I finally got around to it.
I had a hard time even reproducing the issue locally as it only seemed to affect the development build when Netlify built it. The very undescriptive error that a minified production React gives was not very helpful. Finally I ended up nuking my local node_modules folder and lo and behold the error started showing up in my development Create-React-App. I'm still not sure if it was due to server data from the api being cached or what that it wasn't showing up.
When I finally was able to reproduce it locally in development, it quickly became evident that rendering a JSONParsed api response was causing the issue as Open Library's api was responding with a nested object in the description property for one book. And of course React elements can't have children that are POJO:
Objects are not valid as a React child (found: [missing argument]). If you meant to render a collection of children, use an array instead.
I quickly resolved this specific issue by using short-circuiting to render the `value` property of the `description` property if it exists, but this ultimately made me realize that we should be using an api sanitizing class or function that prevents objects being children of React elements if the api were to ever be inconsistent again. Basically the function would attempt to resolve a specific type of value, a string, from an api response and if the value is an object it returns perhaps some stringified json or an error text.
This api response sanitization is perhaps something that is handled behind the scenes by the libraries we use at work to generate front end TS fetch functions from the server side api endpoint code.
I've seen some Tokipona here and there in Geminispace and on Discord and I've started learning a little little bit lili. ijo li ijo, as they say.
I've really been meaning to get back into journaling in my physical journal more often, but ever since I developed hypothyroidism (with the accompanying brain-fog) and chronic leg pain, I've been journaling much less frequently. That was, what, 4 years ago now!? But that's just a number, right? The now is what matters. And digital journaling is better than nothing. And it will hopefully get me back into journaling in my leather journal, too.