File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
packages/storefront/src/images Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,12 @@ export type ImageSize = { width?: number, height?: number };
2929export type TryImageSize = ( src : string ) => ImageSize ;
3030
3131const resetGlobalAstroAssets = ( ) => {
32+ if ( ! globalThis . astroAsset ) return ;
3233 if ( ! globalThis . astroAsset . staticImages ) {
3334 globalThis . astroAsset . staticImages = new Map ( ) ;
35+ // @ts -expect-error: Internal `__ready`.
36+ } else if ( globalThis . astroAsset . staticImages . get . __ready ) {
37+ return ;
3438 }
3539 const _get = globalThis . astroAsset . staticImages . get ;
3640 const _set = globalThis . astroAsset . staticImages . set ;
@@ -41,6 +45,8 @@ const resetGlobalAstroAssets = () => {
4145 }
4246 return _get . apply ( globalThis . astroAsset . staticImages , args ) ;
4347 } ;
48+ // @ts -expect-error: Internal `__ready`.
49+ globalThis . astroAsset . staticImages . get . __ready = true ;
4450 globalThis . astroAsset . staticImages . set = function set ( ...args ) {
4551 if ( args [ 0 ] . includes ( publicDir ) ) {
4652 args [ 0 ] = args [ 0 ] . replace ( publicDir , '' ) ;
@@ -76,6 +82,7 @@ export type UsePictureParams = PictureProps & {
7682} ;
7783
7884const useSSRPicture = async ( params : UsePictureParams ) => {
85+ resetGlobalAstroAssets ( ) ;
7986 const {
8087 src,
8188 alt,
You can’t perform that action at this time.
0 commit comments