Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

180
Visualizações
Wait for All the <iframe>s to finish loading in React-Redux

I'm using the embed iframe from Spotify to show the top tracks of artists in my app:

https://repotify.netlify.app/

When the search is pending a loading spinner is shown until resolved and the same thing happens when the top tracks are being fetched and pending.

But when I render the iframe of each top 10 tracks they start to load and show the box-shadow on page before fully loading:

enter image description here

This is the code for that component:

const TopTracks = ({ track }) => {
  return (
    <div>
      <iframe
        src={`https://open.spotify.com/embed/track/${track.id}`}
        title={track.name}
        width="300"
        height="80"
        allowtransparency="true"
        allow="encrypted-media"
        className="tracks"
      ></iframe>
    </div>
  );
};

export default TopTracks;

What I would like to happen is for the iframes to load completely and then show all at once and while loading, show a spinner like the rest of fetch requests:

enter image description here

This is the functionality for the trackList which maps over the tracks and gets the IDs for each:

// Imports

const TrackList = () => {
  const artistTopTracks = useSelector(selectArtistTopTracks);
  const topTracksIsLoading = useSelector(selectTopTracksIsLoading);
  const topTracksHasError = useSelector(selectTopTracksHasError);
  const searchIsLoading = useSelector(selectSearchIsLoading);
  const searchHasError = useSelector(selectSearchHasError);

  if (topTracksIsLoading || searchIsLoading) return <IsLoading />;
  if (topTracksHasError || searchHasError) return <HasError />;

  return (
    <div>
      {!artistTopTracks
        ? ""
        : artistTopTracks.map((track) => (
            <TopTracks key={track.id} track={track} />
          ))}
    </div>
  );
};

export default TrackList;

Is there a way I can show the loading spinner until all the iframes are loaded?

If not, is there a way to at least not show that shadow-box of each when they're rendering individually?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda