Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!