Rewrite

2022 Week 144 min read

giscus 💎

I've released a new, version 2 of giscus-component! It's been completely rewritten with Lit as a web component. Now, the implementations for the React, Vue, and Svelte components share the exact same code and they only act as a wrapper for the web component. You can compare the code for the React, Vue, and Svelte components and see that they're not that different.

The new implementation allows you to change the configuration without re-rendering the whole component (which would reload the comments). This is done by overriding the re-rendering logic into sending a MessageEvent to the <iframe> using postMessage() every time the props change. Previously, this wasn't really possible because the <iframe> was rendered by the framework. Now that it's within a web component, we can let the web component decide how to re-render itself. Unfortunately, this doesn't seem to work in Svelte as it always re-renders the component for some reason 😕

Getting the whole thing to be compiled and published (with their TypeScript declarations) was a pain. I'm using Vite to bundle each component, which certainly made things a lot easier, but the documentation is still pretty barebones so I had to scour the web to figure out the quirks and obscure errors I encountered. This blog post, this issue, and this issue were particularly helpful.

I also created a new (orphan) branch from scratch. The v1 branch was forked from utterances-component, but it had too many automations and unnecessary stuff that made updating the library such a chore.

I'm so glad to get it all working in the end! I think I should write a blog post about it...

There was also some housekeeping stuff on giscus itself, such as updating the dependencies and updating the GitHub Actions workflow. I also learned about formatToParts(), which I utilized to add spaces between date parts for the Chinese locale.

Work

We're about to call the MVP a wrap. So glad that my stuff mostly works.

There were also some other introduction meetings which I enjoyed.

Ramadan ☪️

Ramadan started on Sunday. For some reason the vibe isn't quite there this year ☹️

I hope my friends and I get to do our "TEDx" talks like last year.

Other stuff

My Wagtail Space US talk is now on YouTube. It's a bit awkward as it's a screen recording of a Zoom meeting with my pre-recorded talk played in the foreground, though. If you'd like to see just the talk itself, I've also uploaded it to my channel.


I played Borderlands 2 with a couple of my high school friends on Monday and Sunday. The last time I played it was back in 2017 when we were about to enter university. Back then, we only got around to play the first few quests, then we stopped playing after our study started. This time, we started a new game, and we've got a bit further than last time. It's a lot of fun to be playing with them again.

Also played Resident Evil 2 Remake on Saturday. Managed to get around 60fps after downscaling the quality to 80%. I had to switch to DX11 as I experienced texture flickering issues with DX12 when the framerate goes below the refresh rate. I just got to the part where the demo ended. Will play again next week.


Sam hasn't been in the mood for a chat these past few weeks, so we skipped our session once again.

Meanwhile, I had a chat with a close friend of mine from university. He's the one who invited me to play World of Warcraft and Final Fantasy XIV. I'll just call him Nat from now on, as it's highly likely that I'll mention him again in future logs. Anyway, it's been a while since the last time, so it was definitely nice to chat with him again.