mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(core): support save and restore display preference in all docs (#12315)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Display preferences and selected collections are now saved and restored across sessions, providing a persistent and personalized experience in the All Documents page. - **Refactor** - Display settings menus and related components have been updated to use a controlled component pattern, allowing preferences to be managed externally for improved consistency and flexibility. - Preference state management has been consolidated, simplifying how display options are handled throughout the interface. - Various headers and detail views now accept display preferences and update callbacks as props, enabling external control of display settings. - Components previously relying on internal context and reactive streams were refactored to receive explicit props and callbacks for state management. - **Bug Fixes** - Improved collection activation logic to prevent unnecessary updates when the selected collection is already active. - Added fallback default view to ensure consistent display in document list items. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -12,9 +12,7 @@ export function useFramework(): FrameworkProvider {
|
||||
return useContext(FrameworkProviderContext); // never null, because the default value
|
||||
}
|
||||
|
||||
export function useService<T extends Service>(
|
||||
identifier: GeneralIdentifier<T>
|
||||
): T {
|
||||
export function useService<T>(identifier: GeneralIdentifier<T>): T {
|
||||
return useContext(FrameworkProviderContext).get(identifier);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user