Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit 59d688a

Browse files
committed
fix: first tweet link undefined
1 parent f4bfcca commit 59d688a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/content-script/hooks/twitter.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,15 @@ class TwitterHook {
8080
} else if (msg.type === 'create-tweet-end') {
8181
if (startPromise) {
8282
const note = await startPromise;
83-
const link = document.querySelector('time')?.parentElement?.getAttribute('href');
84-
note.related_urls = [`https://twitter.com${link}`];
8583

86-
this.main.xlog('info', 'Trigger auto posting tweet...', note);
84+
setTimeout(() => {
85+
const link = document.querySelector('time')?.parentElement?.getAttribute('href');
86+
note.related_urls = [`https://twitter.com${link}`];
8787

88-
this.sync(note);
88+
this.main.xlog('info', 'Trigger auto posting tweet...', note);
89+
90+
this.sync(note);
91+
}, 10);
8992
} else {
9093
this.main.xlog('info', `Failed to find note info.`);
9194
ElMessage.error('CrossSync encountered a problem: Failed to find note info.');

0 commit comments

Comments
 (0)