From 0810798d3019afba5591d334c8d685d494c4495c Mon Sep 17 00:00:00 2001 From: Patrick Fic Date: Tue, 4 Mar 2025 11:14:43 -0800 Subject: [PATCH] IO-3092 Remove compiler warnings. --- .../documents-upload-imgproxy.utility.js | 1 - .../jobs-documents-imgproxy-gallery.component.jsx | 12 ++++++------ ...documents-imgproxy-gallery.external.component.jsx | 10 ++-------- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/client/src/components/documents-upload-imgproxy/documents-upload-imgproxy.utility.js b/client/src/components/documents-upload-imgproxy/documents-upload-imgproxy.utility.js index 8fa7cb001..7ecbd50bb 100644 --- a/client/src/components/documents-upload-imgproxy/documents-upload-imgproxy.utility.js +++ b/client/src/components/documents-upload-imgproxy/documents-upload-imgproxy.utility.js @@ -5,7 +5,6 @@ import { logImEXEvent } from "../../firebase/firebase.utils"; import { INSERT_NEW_DOCUMENT } from "../../graphql/documents.queries"; import { axiosAuthInterceptorId } from "../../utils/CleanAxios"; import client from "../../utils/GraphQLClient"; -import { error } from "logrocket"; //Context: currentUserEmail, bodyshop, jobid, invoiceid diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx index 61b009f13..a07ed0bf1 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.component.jsx @@ -1,7 +1,9 @@ import { EditFilled, FileExcelFilled, SyncOutlined } from "@ant-design/icons"; import { Button, Card, Col, Row, Space } from "antd"; import axios from "axios"; -import { useEffect, useState } from "react"; +import i18n from "i18next"; +import { isFunction } from "lodash"; +import { useCallback, useEffect, useState } from "react"; import { Gallery } from "react-grid-gallery"; import { useTranslation } from "react-i18next"; import Lightbox from "react-image-lightbox"; @@ -16,8 +18,6 @@ import JobsDocumentsDownloadButton from "./jobs-document-imgproxy-gallery.downlo import JobsDocumentsGalleryReassign from "./jobs-document-imgproxy-gallery.reassign.component"; import JobsDocumentsDeleteButton from "./jobs-documents-imgproxy-gallery.delete.component"; import JobsDocumentsGallerySelectAllComponent from "./jobs-documents-imgproxy-gallery.selectall.component"; -import i18n from "i18next"; -import { isFunction } from "lodash"; const mapStateToProps = createStructuredSelector({ bodyshop: selectBodyshop @@ -45,15 +45,15 @@ function JobsDocumentsImgproxyComponent({ const { t } = useTranslation(); const [modalState, setModalState] = useState({ open: false, index: 0 }); - const fetchThumbnails = () => { + const fetchThumbnails = useCallback(() => { fetchImgproxyThumbnails({ setStateCallback: setGalleryImages, jobId }); - }; + }, [jobId, setGalleryImages]); useEffect(() => { if (data) { fetchThumbnails(); } - }, [data]); + }, [data, fetchThumbnails]); const hasMediaAccess = HasFeatureAccess({ bodyshop, featureName: "media" }); const hasMobileAccess = HasFeatureAccess({ bodyshop, featureName: "mobile" }); diff --git a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx index 75943dceb..a970b01b7 100644 --- a/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx +++ b/client/src/components/jobs-documents-imgproxy-gallery/jobs-documents-imgproxy-gallery.external.component.jsx @@ -1,6 +1,5 @@ import { useEffect } from "react"; import { Gallery } from "react-grid-gallery"; -import { useTranslation } from "react-i18next"; import { fetchImgproxyThumbnails } from "./jobs-documents-imgproxy-gallery.component"; /* @@ -13,15 +12,10 @@ import { fetchImgproxyThumbnails } from "./jobs-documents-imgproxy-gallery.compo function JobsDocumentImgproxyGalleryExternal({ jobId, externalMediaState }) { const [galleryImages, setgalleryImages] = externalMediaState; - const { t } = useTranslation(); - - const fetchThumbnails = () => { - fetchImgproxyThumbnails({ setStateCallback: setgalleryImages, jobId, imagesOnly: true }); - }; useEffect(() => { - fetchThumbnails(); - }, [jobId]); + if (jobId) fetchImgproxyThumbnails({ setStateCallback: setgalleryImages, jobId, imagesOnly: true }); + }, [jobId, setgalleryImages]); return (