Skip to content

Commit

Permalink
fix: information collect too early pushed to map
Browse files Browse the repository at this point in the history
  • Loading branch information
Misaka-0x447f authored and Jack-Works committed Oct 25, 2019
1 parent 214d412 commit 18ddb8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/social-network-provider/twitter.com/ui/fetch.ts
Expand Up @@ -57,8 +57,6 @@ const registerPostCollector = (self: SocialNetworkUI) => {
new MutationObserverWatcher(postsSelectors())
.useForeach((node, _, proxy) => {
const info = getEmptyPostInfo(postsRootSelector())
// push to map
self.posts.set(proxy, info)
const collectPostInfo = () => {
const r = postParser(node)
if (!r) return
Expand All @@ -75,6 +73,8 @@ const registerPostCollector = (self: SocialNetworkUI) => {
info.postContent.addListener(newValue => {
info.postPayload.value = deconstructPayload(newValue, self.payloadDecoder)
})
// push to map
self.posts.set(proxy, info)
return {
onNodeMutation: collectPostInfo,
onTargetChanged: collectPostInfo,
Expand Down
1 change: 1 addition & 0 deletions src/social-network-provider/twitter.com/worker/fetch.ts
Expand Up @@ -11,6 +11,7 @@ export const fetchPostContent = async (post: PostIdentifier<PersonIdentifier>) =
// it will be a false-positive and it is dangerous.
// There is a build-in parser.
// Checkout http://mdn.io/DOMParser and we're already using it.
// Legacy js-free mobile twitter may help.
const content = twitterWorkerSelf.publicKeyDecoder(d.innerText)
if (content && content[0].length) return content[0]
return tasks(toPostUrl(post), {}).getPostContent(post)
Expand Down

0 comments on commit 18ddb8d

Please sign in to comment.