mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-15 06:12:18 +00:00
prevent loading gigabytes of images when opening the gallery
This commit is contained in:
1 parent
c017fbc25a
commit
ddc33ce600
1 file changed
+8
@@ -111,6 +111,10 @@ export const GalleryDraggableItem: React.FC<GalleryDraggableItemProps> = ({
|
||||
) : (
|
||||
<img
|
||||
data-gallery-draggable-1="true"
|
||||
// NB: "loading=lazy" is necessary to prevent loading GIGABYTES of images!
|
||||
// It is a bit finnicky, too: you must include this attribute
|
||||
// BEFORE the `src` attribute, or it won't work.
|
||||
loading="lazy"
|
||||
ref={imgRef}
|
||||
src={item.thumbnail}
|
||||
alt={item.label}
|
||||
@@ -179,6 +183,10 @@ export const GalleryDraggableItem: React.FC<GalleryDraggableItemProps> = ({
|
||||
) : (
|
||||
<img
|
||||
data-gallery-draggable-2="true"
|
||||
// NB: "loading=lazy" is necessary to prevent loading GIGABYTES of images!
|
||||
// It is a bit finnicky, too: you must include this attribute
|
||||
// BEFORE the `src` attribute, or it won't work.
|
||||
loading="lazy"
|
||||
ref={imgRef}
|
||||
src={item.thumbnail}
|
||||
alt={item.label}
|
||||
|
||||
Reference in new issue
Block a user