Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: side bar favorited list cannot scroll (#1606)

Himself6574fc43020a29
diff --git a/apps/web/src/components/pure/workspace-slider-bar/index.tsx b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
index 2085dec7df..1b8efe0512 100644
--- a/apps/web/src/components/pure/workspace-slider-bar/index.tsx
+++ b/apps/web/src/components/pure/workspace-slider-bar/index.tsx
@@ -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;