mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08: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 contextValue = useContext(DocExplorerContext);
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
|
|
||||||
|
const groupBy = useLiveData(contextValue.groupBy$);
|
||||||
const groups = useLiveData(contextValue.groups$);
|
const groups = useLiveData(contextValue.groups$);
|
||||||
const view = useLiveData(contextValue.view$);
|
const view = useLiveData(contextValue.view$);
|
||||||
const selectMode = useLiveData(contextValue.selectMode$);
|
const selectMode = useLiveData(contextValue.selectMode$);
|
||||||
@@ -113,8 +114,8 @@ export const DocsExplorer = ({
|
|||||||
const items = groups.map((group: any) => {
|
const items = groups.map((group: any) => {
|
||||||
return {
|
return {
|
||||||
id: group.key,
|
id: group.key,
|
||||||
Component: groups.length > 1 ? GroupHeader : undefined,
|
Component: groupBy ? GroupHeader : undefined,
|
||||||
height: groups.length > 1 ? 24 : 0,
|
height: groupBy ? 24 : 0,
|
||||||
className: styles.groupHeader,
|
className: styles.groupHeader,
|
||||||
items: group.items.map((docId: string) => {
|
items: group.items.map((docId: string) => {
|
||||||
return {
|
return {
|
||||||
@@ -133,7 +134,7 @@ export const DocsExplorer = ({
|
|||||||
} satisfies MasonryGroup;
|
} satisfies MasonryGroup;
|
||||||
});
|
});
|
||||||
return items;
|
return items;
|
||||||
}, [groups, view]);
|
}, [groupBy, groups, view]);
|
||||||
|
|
||||||
const handleCloseFloatingToolbar = useCallback(() => {
|
const handleCloseFloatingToolbar = useCallback(() => {
|
||||||
contextValue.selectMode$?.next(false);
|
contextValue.selectMode$?.next(false);
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ export class DocCreatedByUpdatedBySyncService extends Service {
|
|||||||
workspaceRootDocSynced &&
|
workspaceRootDocSynced &&
|
||||||
isOwnerOrAdmin &&
|
isOwnerOrAdmin &&
|
||||||
missingCreatedBy &&
|
missingCreatedBy &&
|
||||||
!markedSynced
|
!markedSynced &&
|
||||||
|
this.workspaceService.workspace.flavour !== 'local'
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user