From b27de8ab2f59d3057f07b396665ca136e73d0749 Mon Sep 17 00:00:00 2001
From: Serhii
Date: Sun, 15 Sep 2024 19:35:00 +0300
Subject: [PATCH] chore:audio_reload_bug
---
frontend/src/pages/Collection.tsx | 10 ++++++++--
linguaphoto/apprunner.yaml | 2 ++
linguaphoto/crud/image.py | 4 +---
linguaphoto/settings.py | 4 ++++
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/frontend/src/pages/Collection.tsx b/frontend/src/pages/Collection.tsx
index 155a339..14062ae 100644
--- a/frontend/src/pages/Collection.tsx
+++ b/frontend/src/pages/Collection.tsx
@@ -5,7 +5,7 @@ import Modal from "components/modal";
import UploadContent from "components/UploadContent";
import { useAuth } from "contexts/AuthContext";
import { useLoading } from "contexts/LoadingContext";
-import React, { useEffect, useMemo, useState } from "react";
+import React, { useEffect, useMemo, useRef, useState } from "react";
import { Col, Row } from "react-bootstrap";
import {
ArrowLeft,
@@ -31,6 +31,7 @@ const CollectionPage: React.FC = () => {
const { startLoading, stopLoading } = useLoading();
const [showModal, setShowModal] = useState(false);
const [images, setImages] = useState | null>([]);
+ const audioRef = useRef(null);
const apiClient: AxiosInstance = useMemo(
() =>
@@ -101,6 +102,11 @@ const CollectionPage: React.FC = () => {
asyncfunction();
}
}, [collection]);
+ useEffect(() => {
+ if (audioRef.current) {
+ audioRef.current.load();
+ }
+ }, [currentTranscriptionIndex, currentImageIndex]);
const handleCreate = async (e: React.FormEvent) => {
e.preventDefault();
startLoading();
@@ -327,7 +333,7 @@ const CollectionPage: React.FC = () => {
.translation
}
-