feat: Add selected city functional with some debugging

This commit is contained in:
2025-10-22 03:04:58 +03:00
parent 9e47ab667f
commit 50ad374cf5
14 changed files with 430 additions and 175 deletions

View File

@@ -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();

View File

@@ -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 из зависимостей чтобы избежать зацикливания

View File

@@ -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;

View File

@@ -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];

View File

@@ -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 () => {