Unexplainable lag between input focus and autocomplete search entry

Hi all,

I vibe-coded a tool with an economist family friend, to calculate the impact of various US tariffs on imports by other countries to the United States. The central user interface is an auto-completing search bar that searches countries or import items (as HTS-6 codes, taken from the USITC DataWeb site). I’ve made sure to refactor code where necessary, and performance optimize - even inserting logging statements throughout my code to determine what is causing the input lag. But the only insight I’ve been able to notice in determining a root cause for this…is that the lag is less on Firefox than on Chromium-based browsers (Edge, Chrome, etc.). Is this something specific to my project, or is this something unique to the Vercel platform?

Expected behavior: near-instantaneous autocomplete search on the search bar (this occurs immediately after page load)

Observed behavior: the first search works fine but all additional searches take longer and longer to respond, with a lag between 1 to 3 seconds from input focus to display of the first keystroke(s). The search itself appears to be optimized, as is the input dropdown behavior of the autocomplete search bar. I have refactored code where necessary to avoid duplicate operations, and performance optimized the feature (debouncing, caching, aggressively garbage collecting the DOM, etc.).

The code as designed pulls from a hand-updated .csv (stored as a Vercel blob, rows being HTS-6 item descriptions and columns being countries) before loading that into memory and searching on it. To reproduce the issue, simply notice the time lag between the first and subsequent searches on the tool.

I am using Vercel v0 to generate and publish the app. Primarily developing from a Windows laptop, but my family friend has also noticed the lag from his machine (MacBook running Chrome). As mentioned before, the lag seems a bit less on Firefox, but still noticeable.

When I quizzed the AI, I received this information:

Technical Evidence:

  • All React operations are sub-millisecond (0.1-1.3ms)
  • 874.9ms lag occurs in browser’s native input handling, not application code
  • DOM remains stable at 405 elements throughout interaction
  • Environment: Chrome/Edge in Vercel preview iframe

Conclusion: This is a Chromium browser limitation in iframe-based preview environments, not a code issue. Firefox’s superior input handling architecture makes it less susceptible to this iframe-specific performance degradation.

Are you seeing this issue only in the v0 preview or also in your live deployment on Vercel?

One big contributor to input lag is browser extensions like password managers, which could explain some differences between browsers for you

Seeing it both on the preview as well as in the live deployment on Vercel. Tried it on a private browsing window that has no extensions installed, and I still see the same input lag.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.