Skip to content

Commit 2f11414

Browse files
fix for [warning] object was filtered for serialization in Tweet code (#2445)
* fix for [warning] object was filtered for serialization in Tweet code When _addParseId() is called on a tweet, it adds a BigInt version of the ID on the end of the object and uses it to sort, which works fine. If you subsequently do anything to the tweet object (console.log it, update it etc), the BigInt is stripped with the warning: [warning] object was filtered for serialization - it;s too big for the parser. Given that it's only used for this one sort and not needed anyway, I dropped the map and did the work in the sort code. Advantage is no extra additions to the object and no map needed. Warning fixed as a result. * updated version * updated version * updated version * Update watch-retweets-of-me.mjs * Updated version * Updated version Co-authored-by: michelle0927 <[email protected]>
1 parent f366e43 commit 2f11414

File tree

7 files changed

+11
-19
lines changed

7 files changed

+11
-19
lines changed

components/twitter/sources/common/tweets.mjs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,15 @@ export default {
2626
},
2727
},
2828
methods: {
29-
_addParsedId(tweet) {
30-
// This is needed since the numeric value of a Tweet's ID can exceed the
31-
// maximum supported value of `number`
32-
const parsedId = BigInt(tweet.id_str);
33-
return {
34-
...tweet,
35-
parsedId,
36-
};
37-
},
38-
_compareByIdAsc({ parsedId: a }, { parsedId: b }) {
39-
if (a < b) return -1;
40-
if (a > b) return 1;
29+
_compareByIdAsc({ id_str: a }, { id_str: b }) {
30+
const A = BigInt(a);
31+
const B = BigInt(b);
32+
if (A < B) return -1;
33+
if (A > B) return 1;
4134
return 0;
4235
},
4336
sortTweets(tweets) {
4437
return tweets
45-
.map(this._addParsedId)
4638
.sort(this._compareByIdAsc);
4739
},
4840
/**

components/twitter/sources/my-tweets/my-tweets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "twitter-my-tweets",
66
name: "My Tweets",
77
description: "Emit new Tweets you post to Twitter",
8-
version: "0.0.7",
8+
version: "0.0.8",
99
type: "source",
1010
props: {
1111
...base.props,

components/twitter/sources/new-tweet-in-list/new-tweet-in-list.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "twitter-new-tweet-in-list",
66
name: "New Tweet in List",
77
description: "Emit new Tweets posted by members of a list",
8-
version: "0.0.4",
8+
version: "0.0.5",
99
type: "source",
1010
props: {
1111
...base.props,

components/twitter/sources/user-tweets/user-tweets.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "twitter-user-tweets",
66
name: "User Tweets",
77
description: "Emit new Tweets posted by a user",
8-
version: "0.0.7",
8+
version: "0.0.8",
99
type: "source",
1010
props: {
1111
...base.props,

components/twitter/sources/watch-retweets-of-me/watch-retweets-of-me.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
...base,
55
key: "twitter-watch-retweets-of-me",
66
name: "Watch Retweets of Me",
7-
version: "0.0.4",
7+
version: "0.0.5",
88
description: "Emit new event when recent Tweets authored by the authenticating user that have been retweeted by others",
99
type: "source",
1010
props: {

components/twitter/sources/watch-retweets-of-my-tweet/watch-retweets-of-my-tweet.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export default {
55
key: "twitter-watch-retweets-of-my-tweet",
66
name: "Watch Retweets of My Tweet",
77
description: "Emit new event when a specific Tweet from the authenticated user is retweeted",
8-
version: "0.0.3",
8+
version: "0.0.4",
99
type: "source",
1010
props: {
1111
...base.props,

components/twitter/sources/watch-retweets-of-user-tweet/watch-retweets-of-user-tweet.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "twitter-watch-retweets-of-user-tweet",
77
name: "Watch Retweets of User Tweet",
88
description: "Emit new event when a specific Tweet from a user is retweeted",
9-
version: "0.0.3",
9+
version: "0.0.4",
1010
type: "source",
1111
props: {
1212
...base.props,

0 commit comments

Comments
 (0)