diff --git a/src/views/SwipeView.vue b/src/views/SwipeView.vue index 4621dd1..ecb9028 100644 --- a/src/views/SwipeView.vue +++ b/src/views/SwipeView.vue @@ -35,7 +35,7 @@ + @error="onImageError($event, currentUserToSwipe, photo, 'carousel')"> @@ -62,7 +62,7 @@ + @error="onImageError($event, currentUserToSwipe, { url: currentUserToSwipe.mainPhotoUrl, _id: 'main_photo_fallback', isProfilePhoto: true }, 'mainPhotoUrl_fallback')"> @@ -111,7 +111,14 @@ const matchOccurred = ref(false); const currentUserToSwipe = computed(() => { if (suggestions.value.length > 0 && currentIndex.value < suggestions.value.length) { - return suggestions.value[currentIndex.value]; + const currentUser = suggestions.value[currentIndex.value]; + // Log for specific user if needed for deep debugging + if (currentUser && currentUser._id === "682df5f8892811c317d4c43f") { // User "Денис" ID + console.log("[SwipeView DEBUG] currentUserToSwipe for Денис:", JSON.parse(JSON.stringify(currentUser))); + console.log("[SwipeView DEBUG] Денис.mainPhotoUrl:", currentUser.mainPhotoUrl); + console.log("[SwipeView DEBUG] Денис.photos:", currentUser.photos); + } + return currentUser; } return null; }); @@ -230,34 +237,28 @@ const formatGender = (gender) => { return ''; // Возвращаем пустую строку, если пол не указан, чтобы не было "Пол не указан" }; -const onImageError = (event, userOnError, photoWithError) => { // MODIFIED: signature and content +const onImageError = (event, userOnError, photoInfo, sourceType) => { console.warn( - "SwipeView: Не удалось загрузить изображение.", + `SwipeView: Не удалось загрузить изображение (Источник: ${sourceType}).`, { src: event.target.src, user: userOnError.name, - photo_id: photoWithError._id, - photo_url: photoWithError.url, - isProfilePhoto: photoWithError.isProfilePhoto, + userId: userOnError._id, + photo_id: photoInfo._id, + photo_url: photoInfo.url, + isProfilePhotoFlag: photoInfo.isProfilePhoto, + // Log the state of relevant properties of userOnError at the time of error + currentUser_mainPhotoUrl_at_error_time: userOnError.mainPhotoUrl, + currentUser_photos_at_error_time: userOnError.photos ? JSON.parse(JSON.stringify(userOnError.photos)) : 'not present', event_target_attributes: { naturalWidth: event.target.naturalWidth, naturalHeight: event.target.naturalHeight, complete: event.target.complete, }, - errorEventDetails: event + errorEventDetails_type: event.type } ); - // For debugging, let's NOT hide the image for now. - // This will show the browser's default broken image icon. - // event.target.style.display = 'none'; - - // The logic to update userInSuggestions.mainPhotoUrl is outdated. - // const userInSuggestions = suggestions.value.find(u => u._id === userOnError._id); - // if (userInSuggestions && userInSuggestions.photos) { - // if (!userInSuggestions.photos.some(p => p.url)) { - // // userInSuggestions.mainPhotoUrl = null; // Outdated line - // } - // } + // event.target.style.display = 'none'; // Keep commented for debugging to see broken image icon };