From 3bb7711158d4830ae219bb6090c37639eb0b3c8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cspicecat=E2=80=9D?= Date: Thu, 18 Aug 2022 17:58:26 -0400 Subject: [PATCH] weird share answer duplicate fix --- client/src/controllers/PaginatedListController.jsx | 1 - .../QAControllers/QAPaginatedListController.jsx | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/controllers/PaginatedListController.jsx b/client/src/controllers/PaginatedListController.jsx index a3aa761..bdf0361 100644 --- a/client/src/controllers/PaginatedListController.jsx +++ b/client/src/controllers/PaginatedListController.jsx @@ -35,7 +35,6 @@ export default function PaginatedListController({ if (hasAnswerAnchor) { const anchorAnswer = document.getElementById('answersList'); anchorAnswer.scrollIntoView({ behavior: 'smooth' }); - console.log(123, scroll, anchorAnswer) } }, 2000) } diff --git a/client/src/controllers/QAControllers/QAPaginatedListController.jsx b/client/src/controllers/QAControllers/QAPaginatedListController.jsx index 0b2fdff..f6382b5 100644 --- a/client/src/controllers/QAControllers/QAPaginatedListController.jsx +++ b/client/src/controllers/QAControllers/QAPaginatedListController.jsx @@ -35,7 +35,7 @@ export function AnswersList() { .catch(() => []); const currentLocation = window.location.href; const hasAnswerAnchor = currentLocation.includes('#'); - // console.log(answersList, 1111) + if (hasAnswerAnchor) { const anchorAnswerId = `${currentLocation.substring(currentLocation.indexOf("#") + 1)}`; answersList.forEach(function (answer, i) { @@ -45,8 +45,9 @@ export function AnswersList() { } }); } - // console.log(answersList, 222) - + if (answersList.length > 2 && answersList[0].answer_id === answersList[1].answer_id) + answersList.splice(0, 1); + return answersList; }