Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
Global search input on React page

I have a search input in my <Layout> component. The UX I would like is that when you start typing in the box, it changes the URL to /search/?=whatever and uses the Search page to render my results. I have this mostly working but there is a persistent problem where a few characters will go missing, usually the 3rd or 4th, as things transition from the original page to the search page. The code is all up on https://github.com/coderanger/buddy.farm/ if that helps. Might be more of a generic React question but the heart of the issue seems to be navigate() forcing my input focus away from the text field while things process or something?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So I ended up solving this with three rounds of changes. First was the effect fixes mentioned by Andrew Gillis above, those were just straight up bugs. Second was to move the search index out of Gatsby page data (it was previously a static query in the page) and into its own JSON file. Shoutout to this blog post for laying out exactly how, but the short version is to use a createPages hook to run the same GraphQL query and write it to public/search.json, and then write some normal React stuff to load that data when the page mounts with a loading spinner and whatnot. And then third, I used a global context to continue recording the user inputs via onChange event after a navigate() was started and then restore from that once the page mounts.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda