feat: Add selected city functional with some debugging
This commit is contained in:
@@ -435,7 +435,7 @@ class MapStore {
|
||||
|
||||
await routeStore.createRoute(routeData);
|
||||
|
||||
if (!carrier_id) {
|
||||
if (!carrier_id && selectedCityStore.selectedCityId) {
|
||||
toast.error(
|
||||
"В выбранном городе нет доступных перевозчиков, маршрут отображается в общем списке"
|
||||
);
|
||||
@@ -2587,10 +2587,6 @@ const MapSightbar: React.FC<MapSightbarProps> = observer(
|
||||
},
|
||||
];
|
||||
|
||||
React.useEffect(() => {
|
||||
console.log("isOpen changed:", isOpen);
|
||||
}, [isOpen]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`${
|
||||
|
||||
@@ -28,11 +28,8 @@ export const clearGLTFCacheForUrl = async (url: string) => {
|
||||
const gltf = await initializeUseGLTF();
|
||||
if (gltf && gltf.clear) {
|
||||
gltf.clear(url);
|
||||
console.log("🧹 GLTFCacheManager: Очистка кеша для URL", { url });
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("⚠️ GLTFCacheManager: Ошибка при очистке кеша для URL", error);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -43,11 +40,8 @@ export const clearAllGLTFCache = async () => {
|
||||
const gltf = await initializeUseGLTF();
|
||||
if (gltf && gltf.clear) {
|
||||
gltf.clear();
|
||||
console.log("🧹 GLTFCacheManager: Очистка всего кеша GLTF");
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("⚠️ GLTFCacheManager: Ошибка при очистке всего кеша", error);
|
||||
}
|
||||
} catch (error) {}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -57,10 +51,7 @@ export const revokeBlobURL = (url: string) => {
|
||||
if (url && url.startsWith("blob:")) {
|
||||
try {
|
||||
URL.revokeObjectURL(url);
|
||||
console.log("🧹 GLTFCacheManager: Отзыв blob URL", { url });
|
||||
} catch (error) {
|
||||
console.warn("⚠️ GLTFCacheManager: Ошибка при отзыве blob URL", error);
|
||||
}
|
||||
} catch (error) {}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -73,8 +64,6 @@ export const clearBlobAndGLTFCache = async (url: string) => {
|
||||
|
||||
// Затем очищаем кеш GLTF
|
||||
await clearGLTFCacheForUrl(url);
|
||||
|
||||
console.log("🧹 GLTFCacheManager: Комплексная очистка выполнена", { url });
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -85,12 +74,7 @@ export const clearMediaTransitionCache = async (
|
||||
newMediaId: string | number | null,
|
||||
newMediaType?: number
|
||||
) => {
|
||||
console.log("🔄 GLTFCacheManager: Очистка кеша при смене медиа", {
|
||||
previousMediaId,
|
||||
newMediaId,
|
||||
newMediaType,
|
||||
});
|
||||
|
||||
console.log(newMediaId, newMediaType);
|
||||
// Если переключаемся с/на 3D модель, очищаем весь кеш
|
||||
if (newMediaType === 6 || previousMediaId) {
|
||||
await clearAllGLTFCache();
|
||||
|
||||
@@ -247,10 +247,6 @@ export const UploadMediaDialog = observer(
|
||||
setMediaUrl(newBlobUrl);
|
||||
previousMediaUrlRef.current = newBlobUrl; // Сохраняем новый URL в ref
|
||||
setIsPreviewLoaded(false); // Сбрасываем состояние загрузки при смене файла
|
||||
console.log("🆕 UploadMediaDialog: Создан новый blob URL", {
|
||||
newBlobUrl,
|
||||
fileName: mediaFile.name,
|
||||
});
|
||||
}
|
||||
}, [mediaFile]); // Убираем mediaUrl из зависимостей чтобы избежать зацикливания
|
||||
|
||||
|
||||
@@ -551,7 +551,6 @@ class CreateSightStore {
|
||||
});
|
||||
}
|
||||
|
||||
console.log("Sight created with ID:", newSightId);
|
||||
// Optionally: this.clearCreateSight(); // To reset form after successful creation
|
||||
this.needLeaveAgree = false;
|
||||
return newSightId;
|
||||
|
||||
@@ -134,7 +134,6 @@ class RouteStore {
|
||||
|
||||
copyRouteAction = async (id: number) => {
|
||||
const response = await authInstance.post(`/route/${id}/copy`);
|
||||
console.log(response);
|
||||
|
||||
runInAction(() => {
|
||||
this.routes.data = [...this.routes.data, response.data];
|
||||
|
||||
@@ -228,21 +228,13 @@ class SnapshotStore {
|
||||
// Попытка очистить кеш браузера (если поддерживается)
|
||||
if ("caches" in window) {
|
||||
try {
|
||||
caches
|
||||
.keys()
|
||||
.then((cacheNames) => {
|
||||
return Promise.all(
|
||||
cacheNames.map((cacheName) => {
|
||||
return caches.delete(cacheName);
|
||||
})
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
console.log("Кеш браузера очищен");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn("Не удалось очистить кеш браузера:", error);
|
||||
});
|
||||
caches.keys().then((cacheNames) => {
|
||||
return Promise.all(
|
||||
cacheNames.map((cacheName) => {
|
||||
return caches.delete(cacheName);
|
||||
})
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Кеш браузера не поддерживается:", error);
|
||||
}
|
||||
@@ -251,30 +243,20 @@ class SnapshotStore {
|
||||
// Попытка очистить IndexedDB (если поддерживается)
|
||||
if ("indexedDB" in window) {
|
||||
try {
|
||||
indexedDB
|
||||
.databases()
|
||||
.then((databases) => {
|
||||
return Promise.all(
|
||||
databases.map((db) => {
|
||||
if (db.name) {
|
||||
return indexedDB.deleteDatabase(db.name);
|
||||
}
|
||||
return Promise.resolve();
|
||||
})
|
||||
);
|
||||
})
|
||||
.then(() => {
|
||||
console.log("IndexedDB очищен");
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn("Не удалось очистить IndexedDB:", error);
|
||||
});
|
||||
indexedDB.databases().then((databases) => {
|
||||
return Promise.all(
|
||||
databases.map((db) => {
|
||||
if (db.name) {
|
||||
return indexedDB.deleteDatabase(db.name);
|
||||
}
|
||||
return Promise.resolve();
|
||||
})
|
||||
);
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("IndexedDB не поддерживается:", error);
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Все кеши приложения сброшены");
|
||||
};
|
||||
|
||||
getSnapshots = async () => {
|
||||
|
||||
@@ -35,6 +35,7 @@ export const ImageUploadCard: React.FC<ImageUploadCardProps> = ({
|
||||
console.log("isDragOver");
|
||||
}
|
||||
}, [isDragOver]);
|
||||
|
||||
// --- Click to select file ---
|
||||
const handleZoneClick = () => {
|
||||
// Trigger the hidden file input click
|
||||
|
||||
@@ -10,17 +10,9 @@ const clearGLTFCache = (url?: string) => {
|
||||
// Если это blob URL, очищаем его из кеша
|
||||
if (url.startsWith("blob:")) {
|
||||
useGLTF.clear(url);
|
||||
console.log("🧹 clearGLTFCache: Очистка blob URL из кеша GLTF", {
|
||||
url,
|
||||
});
|
||||
} else {
|
||||
useGLTF.clear(url);
|
||||
console.log("🧹 clearGLTFCache: Очистка кеша для URL", { url });
|
||||
}
|
||||
} else {
|
||||
// Очищаем весь кеш GLTF
|
||||
useGLTF.clear();
|
||||
console.log("🧹 clearGLTFCache: Очистка всего кеша GLTF");
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn("⚠️ clearGLTFCache: Ошибка при очистке кеша", error);
|
||||
@@ -56,17 +48,6 @@ const isValid3DFile = (url: string): boolean => {
|
||||
const isValid =
|
||||
hasValidExtension || hasValidType || isBlobUrl || isServerUrl;
|
||||
|
||||
console.log("🔍 isValid3DFile: Проверка файла", {
|
||||
url,
|
||||
pathname,
|
||||
hasValidExtension,
|
||||
fileType,
|
||||
hasValidType,
|
||||
isBlobUrl,
|
||||
isServerUrl,
|
||||
isValid,
|
||||
});
|
||||
|
||||
return isValid;
|
||||
} catch (error) {
|
||||
console.warn("⚠️ isValid3DFile: Ошибка при проверке URL", error);
|
||||
@@ -144,15 +125,9 @@ export const ThreeView = ({
|
||||
useEffect(() => {
|
||||
// Очищаем кеш сразу при монтировании компонента
|
||||
clearGLTFCache(fileUrl);
|
||||
console.log("🧹 ThreeView: Очистка кеша модели при монтировании", {
|
||||
fileUrl,
|
||||
});
|
||||
|
||||
return () => {
|
||||
clearGLTFCache(fileUrl);
|
||||
console.log("🧹 ThreeView: Очистка кеша модели при размонтировании", {
|
||||
fileUrl,
|
||||
});
|
||||
};
|
||||
}, [fileUrl]);
|
||||
|
||||
|
||||
@@ -45,15 +45,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
|
||||
|
||||
// Сбрасываем ошибку только если изменился ID медиа (пользователь выбрал другую модель)
|
||||
if (oldMediaId !== newMediaId) {
|
||||
console.log(
|
||||
"🔄 ThreeViewErrorBoundary: Сброс ошибки при смене модели",
|
||||
{
|
||||
oldKey: state.lastResetKey,
|
||||
newKey: props.resetKey,
|
||||
oldMediaId,
|
||||
newMediaId,
|
||||
}
|
||||
);
|
||||
return {
|
||||
hasError: false,
|
||||
error: null,
|
||||
@@ -63,13 +54,7 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
|
||||
|
||||
// Если изменился только счетчик (нажата кнопка "Попробовать снова"), обновляем lastResetKey
|
||||
// но не сбрасываем ошибку автоматически - ждем результата загрузки
|
||||
console.log(
|
||||
"🔄 ThreeViewErrorBoundary: Обновление lastResetKey без сброса ошибки",
|
||||
{
|
||||
oldKey: state.lastResetKey,
|
||||
newKey: props.resetKey,
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
lastResetKey: props.resetKey,
|
||||
};
|
||||
@@ -142,10 +127,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
|
||||
};
|
||||
|
||||
handleReset = () => {
|
||||
console.log(
|
||||
"🔄 ThreeViewErrorBoundary: Перезагрузка компонента и перезапрос модели"
|
||||
);
|
||||
|
||||
// Сначала сбрасываем состояние ошибки
|
||||
this.setState(
|
||||
{
|
||||
@@ -161,7 +142,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
|
||||
};
|
||||
|
||||
handleClose = () => {
|
||||
console.log("❌ ThreeViewErrorBoundary: Закрытие ошибки");
|
||||
this.setState({
|
||||
hasError: false,
|
||||
error: null,
|
||||
@@ -237,9 +217,6 @@ export class ThreeViewErrorBoundary extends Component<Props, State> {
|
||||
variant="contained"
|
||||
startIcon={<RefreshCw size={16} />}
|
||||
onClick={() => {
|
||||
console.log(
|
||||
"🖱️ ThreeViewErrorBoundary: Клик на кнопку 'Попробовать снова'"
|
||||
);
|
||||
this.handleReset();
|
||||
}}
|
||||
sx={{
|
||||
|
||||
@@ -33,15 +33,8 @@ export function MediaViewer({
|
||||
string | number | null
|
||||
>(null);
|
||||
|
||||
// Сбрасываем ключ при смене медиа
|
||||
useEffect(() => {
|
||||
if (media?.id !== previousMediaId) {
|
||||
console.log("🔄 MediaViewer: Смена медиа, сброс ключа", {
|
||||
previousMediaId,
|
||||
newMediaId: media?.id,
|
||||
mediaType: media?.media_type,
|
||||
});
|
||||
|
||||
// Используем новый cache manager для очистки кеша
|
||||
clearMediaTransitionCache(
|
||||
previousMediaId,
|
||||
@@ -55,16 +48,9 @@ export function MediaViewer({
|
||||
}, [media?.id, media?.media_type, previousMediaId]);
|
||||
|
||||
const handleReset = () => {
|
||||
console.log("🔄 MediaViewer: handleReset вызван", {
|
||||
currentResetKey: resetKey,
|
||||
mediaId: media?.id,
|
||||
});
|
||||
setResetKey((prev) => {
|
||||
const newKey = prev + 1;
|
||||
console.log("🔄 MediaViewer: resetKey обновлен", {
|
||||
oldKey: prev,
|
||||
newKey,
|
||||
});
|
||||
|
||||
return newKey;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -87,7 +87,6 @@ export const RightWidgetTab = observer(
|
||||
}
|
||||
};
|
||||
fetchData();
|
||||
console.log(sight[language].right);
|
||||
}, [sight.common.id]);
|
||||
|
||||
const [activeArticleIndex, setActiveArticleIndex] = useState<number | null>(
|
||||
@@ -175,10 +174,6 @@ export const RightWidgetTab = observer(
|
||||
toast.success("Достопримечательность сохранена");
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
console.log(sight[language].right);
|
||||
}, [sight[language].right]);
|
||||
|
||||
const handleDragEnd = (result: DropResult) => {
|
||||
const { source, destination } = result;
|
||||
|
||||
|
||||
@@ -43,8 +43,6 @@ export const EditStationModal = observer(
|
||||
} = routeStore;
|
||||
|
||||
const handleSave = async () => {
|
||||
console.log(routeId, selectedStationId);
|
||||
|
||||
await saveRouteStations(Number(routeId), selectedStationId);
|
||||
toast.success("Успешно сохранено");
|
||||
onClose();
|
||||
|
||||
Reference in New Issue
Block a user