Skip to content

Commit

Permalink
fix(imagegallery): need to support reloading content
Browse files Browse the repository at this point in the history
  • Loading branch information
scottdickerson committed Dec 1, 2020
1 parent 8ee5011 commit b4a4f32
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/ImageGalleryModal/ImageGalleryModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Grid20, List20 } from '@carbon/icons-react';
import useDeepCompareEffect from 'use-deep-compare-effect';

import { settings } from '../../constants/Settings';
import ComposedModal from '../ComposedModal';
Expand Down Expand Up @@ -105,6 +106,9 @@ const ImageGalleryModal = ({
const [selectedImage, setSelectedImage] = useState();
const [filteredContent, setFilteredContent] = useState(content);

// Need to support lazy loaded content
useDeepCompareEffect(() => setFilteredContent(content), [content]);

const toggleImageSelection = (imageProps) => {
setSelectedImage((currentSelected) => {
return currentSelected?.id === imageProps.id ? undefined : imageProps;
Expand Down

0 comments on commit b4a4f32

Please sign in to comment.