mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-06 03:49:56 +08:00
feat(core): set document title when detail page render (#5418)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import { noop } from 'lodash-es';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useDocumentTitle(newTitle?: string | null) {
|
||||
useEffect(() => {
|
||||
if (environment.isDesktop || !newTitle) {
|
||||
return noop;
|
||||
}
|
||||
|
||||
const oldTitle = document.title;
|
||||
document.title = newTitle;
|
||||
return () => {
|
||||
document.title = oldTitle;
|
||||
};
|
||||
}, [newTitle]);
|
||||
}
|
||||
Reference in New Issue
Block a user