Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

Commit 0ef5842

Browse files
committed
Update index.tsx
1 parent 514647b commit 0ef5842

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/userscript/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,25 @@ function injectButton() {
2626
const entry = document.createElement("div");
2727
entry.id = ENTRYPOINT_ID;
2828
bottomSidebarSection.prepend(entry);
29+
observer.observe(bottomSidebarSection, { childList: true, subtree: true });
2930

30-
const App = (
31+
const App = () => (
3132
<>
3233
<button onclick={() => setIsModalOpen(true)}>Show modal</button>
3334
<Modal isOpen={isModalOpen()} setIsOpen={setIsModalOpen} />
3435
</>
3536
);
3637

37-
render(() => App, entry);
38+
render(App, entry);
3839
}
3940

40-
const observer = new MutationObserver(() => injectButton());
41+
const observer = new MutationObserver(() => {
42+
injectButton();
43+
observer.observe(document.body, { childList: true, subtree: true });
44+
});
45+
46+
// @ts-expect-error
47+
window.observer = observer;
4148

4249
observer.observe(document.body, { childList: true, subtree: true });
4350

0 commit comments

Comments
 (0)