giscus / giscus-component

Component library for giscus, a comment system powered by GitHub Discussions.
https://giscus-component.vercel.app
MIT License
315 stars 25 forks source link

Support Switching Theme without Rerenderer #33

Closed ghost closed 2 years ago

ghost commented 2 years ago

Is your feature request related to a problem? Currently, changing the theme option of the giscus component will lead to a reload of widget frame which downgrade the user experience.

Describe the solution you'd like Creating the widget only once and send configuration change messages to the frame when possible.

laymonage commented 2 years ago

This is implemented in v2.0.0, except for the Svelte component (which theoretically should also work but for some reason it keeps reloading the component when the props change). Could you try @zhl49?

ghost commented 2 years ago

@laymonage thanks for your help. I have tried this new feature on my docusaurus site which works pretty well.

However, there is a problem that an iframe reload will be scheduled for the first theme change request, and subsequent theme change requests will not trigger an iframe reload.

I'm wondering whether it is realted to this part of code. Since I know little about lit, I need your help to verify that.

laymonage commented 2 years ago

Hey @zhl49, thanks for the report. Turns out that issue was caused by a mistake that happens when you use the URL mapping. Upgrading the package to v2.0.3 should fix it. Could you retry when you have the time?

ghost commented 2 years ago

I upgraded the package to v2.0.3 and now it works well. :thumbsup: