Skip to content

Commit

Permalink
wip: fixed rerender of starToggleIcon, needs refactoring then
Browse files Browse the repository at this point in the history
  • Loading branch information
mewdev committed Dec 12, 2024
1 parent 5b9a9b2 commit b9f973c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions apps/web/app/[lang]/otazka/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ export default function Page() {
fetchData();
}, []);

// cleanup useEffects then
useEffect(() => {
// console.log("Component rendered")
}, [steps])

const questionCount = questions.length;

return (
Expand Down Expand Up @@ -179,22 +184,21 @@ export default function Page() {
);
}
})}
{/* Bottom bar
{currentQuestion <= questions.length && currentQuestion > 0 ? (
<ClientBottomBar onClick={handleClick} steps={steps} />
) : null} */}
{/* Bottom bar toggle */}
{/* Bottom bar */}
{/* write more elegantly */}
{questionsArray.map((question, index) => {
const questionNumber = index + 1;
if (question.important === true && questionNumber === currentQuestion) {
return (
<ClientBottomBar starPressed onClick={handleClick} steps={steps} />
// fix needed: better key naming ?
<ClientBottomBar key={`Bottom bar (starPressed): ${question.id}`} starPressed onClick={handleClick} steps={steps} />
);
} else if (
question.important === false &&
questionNumber === currentQuestion
) {
return <ClientBottomBar onClick={handleClick} steps={steps} />;
// fix needed: better key naming ?
return <ClientBottomBar key={`Bottom bar (default): ${question.id}`} onClick={handleClick} steps={steps} />;
}
})}
</div>
Expand Down

0 comments on commit b9f973c

Please sign in to comment.