Page MenuHomePhabricator

Thumbnail: determine how to handle updated `thumbnail` prop
Open, LowestPublic

Description

The current implementation of the Thumbnail component will not react to an updated thumbnail prop, since this was an edge case that seemed nearly impossible when this code was originally implemented in MenuItem. However, now that it is a standalone component, it may be used in different ways and there may be cases where the thumbnail prop will update.

We should figure out how to handle the following cases:

  • thumbnail prop changes while the original thumbnail image is still loading (so the placeholder icon is being displayed): in this case, we should probably just restart the image loading process and continue to show the placeholder
  • thumbnail prop changes after the original thumbnail image has loaded and is being displayed. We could immediately show the placeholder icon until the new image loads, or we could continue showing the old thumbnail until the new image loads. This decision should be based off of potential use cases for this behavior.

Event Timeline

Just came across this while creating a configurable demo for the Card component. I suggest for changing once the image is loaded that the default be to show a placeholder, but that this can be overridden with a prop to still show the old icon. Also, perhaps the placeholder shown while reloading should be different from the placeholder before the first load, like cdxIconReload?

Cross link T314236