feat(core): set document title when detail page render (#5418)

This commit is contained in:
Joooye_34
2023-12-27 15:25:26 +00:00
parent a6f5a03b8a
commit 6b9f77f511
2 changed files with 18 additions and 0 deletions
@@ -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]);
}