useDocumentTitle changes title on first title change, scrollBar renders when expected

This commit is contained in:
Daniel Avila 2023-02-14 21:23:14 -05:00
parent 7347eda219
commit f18317f7b7
5 changed files with 16 additions and 85 deletions

View file

@ -18,7 +18,7 @@ const Messages = ({ messages }) => {
return () => {
clearTimeout(timeoutId);
};
}, []);
}, [messages]);
const scrollToBottom = () => {
messagesEndRef.current?.scrollIntoView({ behavior: 'smooth' });
@ -72,7 +72,7 @@ const Messages = ({ messages }) => {
timeout={400}
classNames="scroll-down"
unmountOnExit={false}
appear
// appear
>
{(state) => showScrollButton && <ScrollToBottom scrollHandler={scrollHandler} />}
</CSSTransition>

View file

@ -8,13 +8,13 @@ function useDocumentTitle(title, prevailOnUnmount = false) {
document.title = title;
}, [title]);
useEffect(
() => () => {
if (!prevailOnUnmount) {
document.title = defaultTitle.current;
}
}, []
);
// useEffect(
// () => () => {
// if (!prevailOnUnmount) {
// document.title = defaultTitle.current;
// }
// }, []
// );
}
export default useDocumentTitle;

View file

@ -10,13 +10,13 @@
.scroll-down-enter {
opacity: 0;
}
.scroll-down-appear {
/* .scroll-down-appear {
opacity: 0;
}
} */
.scroll-down-enter-active {
opacity: 1;
transition: opacity 650ms;
transition: opacity 400ms;
}
.scroll-down-exit {
@ -25,7 +25,7 @@
.scroll-down-exit-active {
opacity: 0;
transition: opacity 650ms;
transition: opacity 400ms;
}
.blink {