mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-21 10:50:14 +01:00
complete renaming functions, abstracts more svg, sets title to current convo title, adds a try again feature to errors
This commit is contained in:
parent
592b7629aa
commit
5af5a97d8f
24 changed files with 512 additions and 82 deletions
20
src/hooks/useDocumentTitle.js
Normal file
20
src/hooks/useDocumentTitle.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// useDocumentTitle.js
|
||||
import { useRef, useEffect } from 'react';
|
||||
|
||||
function useDocumentTitle(title, prevailOnUnmount = false) {
|
||||
const defaultTitle = useRef(document.title);
|
||||
|
||||
useEffect(() => {
|
||||
document.title = title;
|
||||
}, [title]);
|
||||
|
||||
useEffect(
|
||||
() => () => {
|
||||
if (!prevailOnUnmount) {
|
||||
document.title = defaultTitle.current;
|
||||
}
|
||||
}, []
|
||||
);
|
||||
}
|
||||
|
||||
export default useDocumentTitle;
|
||||
Loading…
Add table
Add a link
Reference in a new issue