fix: fix upload bug 3d
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
import { Box } from "@mui/material";
|
||||
import { useState } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
|
||||
import { ReactPhotoSphereViewer } from "react-photo-sphere-viewer";
|
||||
import { ThreeView } from "./ThreeView";
|
||||
import { ThreeViewErrorBoundary } from "./ThreeViewErrorBoundary";
|
||||
import { clearMediaTransitionCache } from "../../shared/lib/gltfCacheManager";
|
||||
|
||||
export interface MediaData {
|
||||
id: string | number;
|
||||
@@ -28,6 +29,30 @@ export function MediaViewer({
|
||||
}>) {
|
||||
const token = localStorage.getItem("token");
|
||||
const [resetKey, setResetKey] = useState(0);
|
||||
const [previousMediaId, setPreviousMediaId] = useState<
|
||||
string | number | null
|
||||
>(null);
|
||||
|
||||
// Сбрасываем ключ при смене медиа
|
||||
useEffect(() => {
|
||||
if (media?.id !== previousMediaId) {
|
||||
console.log("🔄 MediaViewer: Смена медиа, сброс ключа", {
|
||||
previousMediaId,
|
||||
newMediaId: media?.id,
|
||||
mediaType: media?.media_type,
|
||||
});
|
||||
|
||||
// Используем новый cache manager для очистки кеша
|
||||
clearMediaTransitionCache(
|
||||
previousMediaId,
|
||||
media?.id || null,
|
||||
media?.media_type
|
||||
);
|
||||
|
||||
setResetKey(0);
|
||||
setPreviousMediaId(media?.id || null);
|
||||
}
|
||||
}, [media?.id, media?.media_type, previousMediaId]);
|
||||
|
||||
const handleReset = () => {
|
||||
console.log("🔄 MediaViewer: handleReset вызван", {
|
||||
|
||||
Reference in New Issue
Block a user