PostHistoryPage で重複サムネが表示されないバグ(#278) (#293)
#278 Co-authored-by: miteruzo <miteruzo@naver.com> Reviewed-on: #293
This commit was merged in pull request #293.
This commit is contained in:
@@ -37,6 +37,8 @@ export default (() => {
|
|||||||
document.querySelector ('table')?.scrollIntoView ({ behavior: 'smooth' })
|
document.querySelector ('table')?.scrollIntoView ({ behavior: 'smooth' })
|
||||||
}, [location.search])
|
}, [location.search])
|
||||||
|
|
||||||
|
const layoutIds: string[] = []
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainArea>
|
<MainArea>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
@@ -60,7 +62,7 @@ export default (() => {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{changes.map ((change, i) => {
|
{changes.map ((change, i) => {
|
||||||
let withPost = i === 0 || change.post.id !== changes[i - 1].post.id
|
const withPost = i === 0 || change.post.id !== changes[i - 1].post.id
|
||||||
if (withPost)
|
if (withPost)
|
||||||
{
|
{
|
||||||
rowsCnt = 1
|
rowsCnt = 1
|
||||||
@@ -70,6 +72,13 @@ export default (() => {
|
|||||||
++j)
|
++j)
|
||||||
++rowsCnt
|
++rowsCnt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let layoutId: string | undefined = `page-${ change.post.id }`
|
||||||
|
if (layoutIds.includes (layoutId))
|
||||||
|
layoutId = undefined
|
||||||
|
else
|
||||||
|
layoutIds.push (layoutId)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag?.id }`}
|
<tr key={`${ change.timestamp }-${ change.post.id }-${ change.tag?.id }`}
|
||||||
className={cn ('even:bg-gray-100 dark:even:bg-gray-700',
|
className={cn ('even:bg-gray-100 dark:even:bg-gray-700',
|
||||||
@@ -79,12 +88,14 @@ export default (() => {
|
|||||||
rowSpan={rowsCnt}>
|
rowSpan={rowsCnt}>
|
||||||
<PrefetchLink to={`/posts/${ change.post.id }`}>
|
<PrefetchLink to={`/posts/${ change.post.id }`}>
|
||||||
<motion.div
|
<motion.div
|
||||||
layoutId={`page-${ change.post.id }`}
|
layoutId={layoutId}
|
||||||
transition={{ type: 'spring',
|
transition={{ type: 'spring',
|
||||||
stiffness: 500,
|
stiffness: 500,
|
||||||
damping: 40,
|
damping: 40,
|
||||||
mass: .5 }}>
|
mass: .5 }}>
|
||||||
<img src={change.post.thumbnail || change.post.thumbnailBase || undefined}
|
<img src={change.post.thumbnail
|
||||||
|
|| change.post.thumbnailBase
|
||||||
|
|| undefined}
|
||||||
alt={change.post.title || change.post.url}
|
alt={change.post.title || change.post.url}
|
||||||
title={change.post.title || change.post.url || undefined}
|
title={change.post.title || change.post.url || undefined}
|
||||||
className="w-40"/>
|
className="w-40"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user