You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
observe remains active on views where it shouldn't run (example)
components Svelte remain in memory and still listening to events like URL changes
Svelte component issue
When I mount() components the first time and then they're removed by GitHub, they're still in memory but dormant, potentially garbage collected if we're lucky.
However with self-updating components, they continue to self-update even when not attached to the document.
the previous component is still updated in memory even if rendered nowhere. This specifically happens because GitHub is removing the first one, so observe will mount a new one.
unload features (I might slip in an auto-unload right before init)
use the signal to unmount
But then again a url store would then become meaningless if every page load removed all svelte components. I don’t think it's practical. Also this would bring us back to "a new component is needed, but rgh-seen is still there"
Custom elements have a native disconnectCallback, but sadly extensions cannot use custom elements (outside the MAIN world).
Such a callback would let us detect when React removes our element, while keeping the element active as well as re-activate it if it comes back into the document.
There are two lightweight ways to replicate this:
create a custom element like <rgh-widget> to independently inject into MAIN and to use as an event emitter
use ResizeObserver to detect connect/disconnect events:
Activity
fregante commentedon Jul 28, 2026
Solution: unmount on
navigateinit)unmountBut then again a
urlstore would then become meaningless if every page load removed all svelte components. I don’t think it's practical. Also this would bring us back to "a new component is needed, but rgh-seen is still there"fregante commentedon Jul 28, 2026
Solution: unmount before mount
Or maybe "unmount previous before mounting again", no need to specifically unmount everything every time.
This is currently being achieved via
singleton()functionfregante commentedon Jul 28, 2026
Solution: mount once, re-attach later
Instead of calling
mount()every time, we just restore the element that was removed by GitHub:refined-github/source/features/closing-remarks.tsx
Lines 37 to 41 in 9a28ac8
We actually had something similar in JSX land too:
getUi()generates and caches a component, and a manager adds or removes itrefined-github/source/features/prevent-link-loss.tsx
Lines 80 to 86 in 9a28ac8
fregante commentedon Jul 28, 2026
Solution: disconnect callback
Custom elements have a native
disconnectCallback, but sadly extensions cannot use custom elements (outside the MAIN world).Such a callback would let us detect when React removes our element, while keeping the element active as well as re-activate it if it comes back into the document.
There are two lightweight ways to replicate this:
<rgh-widget>to independently inject into MAIN and to use as an event emitterResizeObserverto detect connect/disconnect events:and then:
table-inputappears on new PR lists #10093