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

151
Vistas
React: shuffle not working in production build

we've got a rather annoying problem with react. We're trying to shuffle an array except for one element on page load.

    const withoutSort = variants.filter((variant, index) => {
      if (variant.sorting >= 10) {
        return false;
      }
      return variant;
    });

    const sorted = shuffleArray(
      variants.filter((variant, index) => {
        if (variant.sorting >= 10) {
          return variant;
        }
        return false;
      })
    );

    sortedVariants = sorted.concat(withoutSort);
              {sortedVariants.map((variant, i) => (
                <Tile
                  {...variant}
                  key={variant.title + i}
                  className={tileClasses + ' ' + tileStyle[currentSidebarState]}
                  letter={variant.tileTitle}
                  colorCode={variant.colorCode}
                  textHighlightColor={variant.textHighlightColor}
                />
              ))}

Everything works fine, except for the images in the tile, they seem to land randomly on any tile not the correct one. And this only happens in production after the build.

about 4 years ago · Juan Pablo Isaza
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