mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
fix: side bar favorited list cannot scroll (#1606)
Co-authored-by: sheben404 <sheben404@gmail.com>
This commit is contained in:
@@ -49,8 +49,15 @@ const FavoriteList: React.FC<FavoriteListProps> = ({
|
||||
() => pageMeta.filter(p => p.favorite && !p.trash),
|
||||
[pageMeta]
|
||||
);
|
||||
|
||||
return (
|
||||
<MuiCollapse in={showList}>
|
||||
<MuiCollapse
|
||||
in={showList}
|
||||
style={{
|
||||
maxHeight: 300,
|
||||
overflowY: 'auto',
|
||||
}}
|
||||
>
|
||||
{favoriteList.map((pageMeta, index) => {
|
||||
const active = router.query.pageId === pageMeta.id;
|
||||
return (
|
||||
@@ -58,6 +65,11 @@ const FavoriteList: React.FC<FavoriteListProps> = ({
|
||||
<StyledSubListItem
|
||||
data-testid={`favorite-list-item-${pageMeta.id}`}
|
||||
active={active}
|
||||
ref={ref => {
|
||||
if (ref && active) {
|
||||
ref.scrollIntoView({ behavior: 'smooth' });
|
||||
}
|
||||
}}
|
||||
onClick={() => {
|
||||
if (active) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user