Using MutationObserver for infinite scroll – any shorter implementation? #1892
Unanswered
minhchi1509
asked this question in
Q&A
Replies: 1 comment
-
This is the correct way to do this. You may want to follow #1704, improvements there would probably simplify you implementation. That issue isn't a high priority right now though, so no estimate for when it would be implemented. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I’m working on a content script that adds a custom button/UI to Instagram posts. Since Instagram loads more posts when scrolling, I’m using a
MutationObserver
to detect newly added elements and attach my UI.Here’s a simplified version of my code (I’m keeping track of processed elements and using
createShadowRootUi
to mount a React component):It works, but the implementation feels verbose. I tried
ui.autoMount()
hoping it would simplify things, but then the button doesn’t show up.👉 My question: is there a shorter or more idiomatic way in WXT to handle infinite scroll scenarios like Instagram, without manually wiring up a
MutationObserver
and a processed set?Beta Was this translation helpful? Give feedback.
All reactions