mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
fix(core): fix all docs group header (#12334)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Improved document grouping logic in the explorer view, allowing for more dynamic and responsive updates when changing grouping criteria. - **Bug Fixes** - Prevented unnecessary synchronization operations in local workspace environments, ensuring sync only occurs for applicable workspace types. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -101,6 +101,7 @@ export const DocsExplorer = ({
|
||||
const contextValue = useContext(DocExplorerContext);
|
||||
const docsService = useService(DocsService);
|
||||
|
||||
const groupBy = useLiveData(contextValue.groupBy$);
|
||||
const groups = useLiveData(contextValue.groups$);
|
||||
const view = useLiveData(contextValue.view$);
|
||||
const selectMode = useLiveData(contextValue.selectMode$);
|
||||
@@ -113,8 +114,8 @@ export const DocsExplorer = ({
|
||||
const items = groups.map((group: any) => {
|
||||
return {
|
||||
id: group.key,
|
||||
Component: groups.length > 1 ? GroupHeader : undefined,
|
||||
height: groups.length > 1 ? 24 : 0,
|
||||
Component: groupBy ? GroupHeader : undefined,
|
||||
height: groupBy ? 24 : 0,
|
||||
className: styles.groupHeader,
|
||||
items: group.items.map((docId: string) => {
|
||||
return {
|
||||
@@ -133,7 +134,7 @@ export const DocsExplorer = ({
|
||||
} satisfies MasonryGroup;
|
||||
});
|
||||
return items;
|
||||
}, [groups, view]);
|
||||
}, [groupBy, groups, view]);
|
||||
|
||||
const handleCloseFloatingToolbar = useCallback(() => {
|
||||
contextValue.selectMode$?.next(false);
|
||||
|
||||
@@ -136,7 +136,8 @@ export class DocCreatedByUpdatedBySyncService extends Service {
|
||||
workspaceRootDocSynced &&
|
||||
isOwnerOrAdmin &&
|
||||
missingCreatedBy &&
|
||||
!markedSynced
|
||||
!markedSynced &&
|
||||
this.workspaceService.workspace.flavour !== 'local'
|
||||
)
|
||||
),
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user