fix(extension): paginate Twitter bookmark-folder imports past the first page#1269
Open
abhay-codes07 wants to merge 1 commit into
Open
Conversation
…st page Importing a bookmark folder silently capped at the first API page while reporting the truncated count as a successful import. Three things conspired: - the pagination recursion was gated on !isFolderImport, so folder imports never followed the cursor at all - buildBookmarkCollectionVariables had no cursor parameter, so even if the recursion had run, every request would have re-fetched page 1 - the folder branch of the URL construction appended the encoded variables twice when a cursor was present (the inner ternary already included them, then the outer template added them again) Thread the cursor through buildBookmarkCollectionVariables, drop the folder exclusion from the recursion guard (termination is handled the same way as the regular bookmarks flow: last page yields no tweets), and collapse the nested URL ternaries into a single base-URL + variables expression, which removes the double-append path entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1267
What
Importing a Twitter bookmark folder silently capped at the first API page while reporting the truncated count as a complete import. Three related defects in the import path:
!this.config.isFolderImport, so folder imports never followed the cursorbuildBookmarkCollectionVariableshad no cursor parameter, so even with recursion every request would re-fetch page 1&variables=...twice when a cursor was present (the inner ternary already included it, then the outer template appended it again)Fix
buildBookmarkCollectionVariables(bookmarkCollectionId, cursor?)threads the cursor exactly likebuildRequestVariablesdoes for the regular flowbaseUrl + variablesexpression, which removes the double-append path entirelyThe 1s inter-page delay and 429 backoff apply to folder pages the same as regular pages.
Testing
bun run compile(tsc --noEmit) — cleanbun run build(wxt, chrome-mv3) — cleanbiome checkon both touched files — cleanI don't have a Twitter account with a 100+ tweet bookmark folder to drive the full flow end-to-end, so a maintainer with one may want to sanity-check the second page lands; the cursor extraction (
extractNextCursor) and tweet parsing (getAllTweets) already handle the folder timeline shape and are unchanged.cc @MaheshtheDev