Skip to content

Commit 5930ed9

Browse files
committed
fix: followers hidden when hide who to follow is enabled
1 parent 101452d commit 5930ed9

File tree

1 file changed

+5
-7
lines changed
  • src/contentScripts/scripts/tweetProcessor

1 file changed

+5
-7
lines changed

src/contentScripts/scripts/tweetProcessor/index.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ function observeTweets(element: Element, options: any): void {
1414
const observer = new MutationObserver((mutations: MutationRecord[]) => {
1515
mutations.forEach((mutation: MutationRecord) => {
1616
mutation.addedNodes.forEach((node: Node) => {
17-
if (
18-
node.nodeType === Node.ELEMENT_NODE
19-
&& (node as Element).matches('[data-testid="cellInnerDiv"]')
20-
)
17+
const isInTimelineView = (node as Element).closest('[aria-label="Timeline: Your Home Timeline"]')
18+
const isTweetSection = (node as Element).matches('[data-testid="cellInnerDiv"]')
19+
20+
if (node.nodeType === Node.ELEMENT_NODE && isTweetSection && isInTimelineView)
2121
processTweet(node as HTMLElement, options)
2222
})
2323
})
@@ -30,9 +30,7 @@ function observeTweets(element: Element, options: any): void {
3030
observer.observe(element, { childList: true, subtree: true })
3131
}
3232

33-
export async function initializeTweetObserver(
34-
options: any,
35-
): Promise<void> {
33+
export async function initializeTweetObserver(options: any): Promise<void> {
3634
const tweetsContainer = await getTweetsContainer()
3735
tweetsContainer
3836
.querySelectorAll('[data-testid="cellInnerDiv"]')

0 commit comments

Comments
 (0)