File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -25,13 +25,27 @@ const PlayThumbnail = ({ play }) => {
2525 const loadCover = async ( ) => {
2626 try {
2727 if ( play . cover ) {
28- setCover ( play . cover ) ;
28+ const img = new Image ( ) ;
29+ img . onload = ( ) => {
30+ setCover ( play . cover ) ;
31+ } ;
32+ img . onerror = async ( ) => {
33+ const image = await loadCoverImage ( play . slug ) ;
34+ setCover ( image ) ;
35+ } ;
36+ img . src = play . cover ;
2937 } else {
3038 const image = await loadCoverImage ( play . slug ) ;
3139 setCover ( image ) ;
3240 }
3341 } catch ( error ) {
3442 console . error ( error ) ;
43+ try {
44+ const image = await loadCoverImage ( play . slug ) ;
45+ setCover ( image ) ;
46+ } catch ( fallbackError ) {
47+ console . error ( 'Failed to load both external and local images:' , fallbackError ) ;
48+ }
3549 }
3650 } ;
3751 loadCover ( ) ;
You can’t perform that action at this time.
0 commit comments