mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
refactor(core): refactor collection to use new filter system (#12228)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new Collection entity and store with reactive management and real-time updates. - Added reactive favorite and shared filters with expanded filtering options. - **Refactor** - Overhauled collection and filtering logic for better performance and maintainability. - Replaced legacy filtering UI and logic with a streamlined, service-driven rules system. - Updated collection components to use reactive data streams and simplified props. - Simplified collection creation by delegating ID generation and instantiation to the service layer. - Removed deprecated hooks and replaced state-based filtering with observable-driven filtering. - **Bug Fixes** - Improved accuracy and consistency of tag and favorite filtering in collections. - **Chores** - Removed deprecated and unused filter-related files, types, components, and styles to reduce complexity. - Cleaned up imports and removed unused code across multiple components. - **Documentation** - Corrected inline documentation for improved clarity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
17
packages/common/env/src/filter.ts
vendored
17
packages/common/env/src/filter.ts
vendored
@@ -55,23 +55,6 @@ export const collectionSchema = z.object({
|
||||
createDate: z.union([z.date(), z.number()]).optional(),
|
||||
updateDate: z.union([z.date(), z.number()]).optional(),
|
||||
});
|
||||
export const deletedCollectionSchema = z.object({
|
||||
userId: z.string().optional(),
|
||||
userName: z.string(),
|
||||
collection: collectionSchema,
|
||||
});
|
||||
export type DeprecatedCollection = {
|
||||
id: string;
|
||||
name: string;
|
||||
workspaceId: string;
|
||||
filterList: z.infer<typeof filterSchema>[];
|
||||
allowList?: string[];
|
||||
};
|
||||
export type Collection = z.input<typeof collectionSchema>;
|
||||
export type DeleteCollectionInfo = {
|
||||
userId: string;
|
||||
userName: string;
|
||||
} | null;
|
||||
export type DeletedCollection = z.input<typeof deletedCollectionSchema>;
|
||||
|
||||
export type PropertiesMeta = DocsPropertiesMeta;
|
||||
|
||||
@@ -182,7 +182,7 @@ export function yjsObservePath(yjs?: any, path?: string) {
|
||||
* observable will automatically update when yjs data changed.
|
||||
*
|
||||
* @example
|
||||
* yjsObserveDeep(yjs) -> emit when any of children changed
|
||||
* yjsObserve(yjs) -> emit when yjs type changed
|
||||
*/
|
||||
export function yjsObserve(yjs?: any) {
|
||||
return new Observable(subscriber => {
|
||||
|
||||
Reference in New Issue
Block a user