Commit 8a250ce8 by Liu

fix:常见问题

parent ef5ed928
...@@ -131,6 +131,9 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ ...@@ -131,6 +131,9 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
updateDisplayedItems() updateDisplayedItems()
}, [updateDisplayedItems]) }, [updateDisplayedItems])
// 当上游将 questions 清空时,立即清空展示项,避免短暂显示旧数据
const itemsToRender = questions.length === 0 ? [] : displayedItems
return ( return (
<div <div
className="bg-white box-border px-[20px] py-[12px] w-full sm:w-[300px] md:w-[300px]" className="bg-white box-border px-[20px] py-[12px] w-full sm:w-[300px] md:w-[300px]"
...@@ -180,7 +183,7 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({ ...@@ -180,7 +183,7 @@ const QuestionListBase: React.FC<QuestionListProps & WithAuthProps> = ({
animate="visible" animate="visible"
className="mt-[8px] flex flex-col gap-[8px] w-full" className="mt-[8px] flex flex-col gap-[8px] w-full"
> >
{displayedItems.map((item, index) => ( {itemsToRender.map((item, index) => (
<motion.li <motion.li
key={`question-${item}`} key={`question-${item}`}
custom={index} custom={index}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment