Skip to content

fix(twitter): use pushState for search SPA navigation#105

Open
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-search-nav
Open

fix(twitter): use pushState for search SPA navigation#105
Astro-Han wants to merge 1 commit intojackwener:mainfrom
Astro-Han:worktree-fix-search-nav

Conversation

@Astro-Han
Copy link
Contributor

Summary

Fixes twitter search returning empty results. The current search input approach (nativeSetter + KeyboardEvent('keydown', Enter)) does not reliably trigger Twitter's form submission — the synthetic event is ignored by React, leaving the page on /explore with zero SearchTimeline API calls captured.

Replaces with history.pushState + PopStateEvent('popstate'), which triggers React Router's listener and performs a true SPA navigation to /search?q=...&f=top. The interceptor survives because no full page reload occurs.

This is a follow-up to #100 which fixed the interceptor pipeline but kept the upstream search input approach.

Test plan

  • npm run typecheck passes
  • npx vitest run src/ — 222 tests pass
  • twitter search --query "opencli" --limit 3 — returns results with correct authors
  • twitter search --query "it's a test" — single quote in query handled safely via JSON.stringify

…PA navigation

The previous approach (nativeSetter + Enter keydown on the search input)
does not reliably trigger Twitter's form submission - the synthetic
KeyboardEvent is ignored by React, leaving the page on /explore with
zero API calls captured.

Use history.pushState + PopStateEvent instead, which triggers React
Router's listener and performs a true SPA navigation to /search.
The interceptor survives because no full page reload occurs.

Tested: "opencli", "it's a test" (single quote), "hello" all return
results with correct author attribution.
@Astro-Han Astro-Han force-pushed the worktree-fix-search-nav branch from 2f86ffe to c0f814c Compare March 19, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant