question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Thumbnails do not update with images when state changes.

See original GitHub issue

I am polling an endpoint for new images using a setInterval() function.

Every interval I set the state of a responses array.

 render(){
    return (
      <Carousel
        selectedItem={this.state.selectedItem}
        onClickThumb={this._onClickThumb.bind(this)}
      >
        {
          this.state.responses.map(function(url){
              return <img src={url} key={url} />
            }
          )
        }
      </Carousel>
    )
  }
}

When I get a new image, the image is present in “ul.control-dots” but not in the thumbs.

The thumbs do not update along with the changing images.

Is there a way to refresh the thumbs when I add or remove images?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
driskellcommented, Mar 13, 2018

Another workaround is to set a key against the carousel component that corresponds to the images. In my case the images were small number so I stringify the images list. This causes a change in images to render a new carousel component and destroy the old one.

0reactions
justin22commented, Feb 28, 2019

Weirdly, this issue still happens for me. The slider images gets updated, but not the thumbs. I have gone through the PR, but couldn’t find the solution.

<Carousel 
  showArrows={true}
  showStatus={false}
  showThumbs={true}
  showIndicators={false}
  swipeable={true}
  infiniteLoop={false}
  useKeyboardArrows={true}
>
  {
    this.props.images.map((value, index) => {
      return (
       <div key={index}>
         <img 
           key={index}
           src={value.image} 
         />
      </div>            
     )
   })
  }
</Carousel>

Update: I was able to override this with forceUpdate based on some other props on the page

Read more comments on GitHub >

github_iconTop Results From Across the Web

Image thumbnails will not update - Microsoft Community
1. Open Windows Explorer · 2. Click on Options and Change folder and search options · 3. Next, click on the View tab...
Read more >
Fix Windows 10 Picture Thumbnails Not Showing
Click Apply and OK. Windows 10 image thumbnails not showing problem should resolve now. Method 3: Change Visual Effect Settings of Windows 10....
Read more >
React hooks not updating state for array of images on click event
At the moment the active slide and index is both being passed to the function correctly. However the activeSlide in state doesn't update....
Read more >
Solved: Thumbnail update fails - Esri Community
I go to the details page, click on edit, and then on the thumbnail picture to change it. It states the size should...
Read more >
Thumbnail not updated [#2749695] | Drupal.org
When I change an image file to a media entity of type image, the thumbnail is not updated. First I noticed this when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found