mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 01:40:15 +01:00
feat: auto-scroll to the bottom of the conversation (#1049)
* added button for autoscroll
* fix(General) removed bold
* fix(General) typescript error with checked={autoScroll}
* added return condition for new conversations
* refactor(Message) limit nesting
* fix(settings) used effects
* fix(Message) disabled autoscroll when search
* test(AutoScrollSwitch)
* fix(AutoScrollSwitch) test
* fix(ci): attempt to debug workflow
* refactor: move AutoScrollSwitch from General file, don't use cache for npm
* fix(ci): add test config to avoid redirects and silentRefresh
* chore: add back workflow caching
* chore(AutoScrollSwitch): remove comments, fix type issues, clarify switch intent
* refactor(Message): remove unnecessary message prop form scrolling condition
* fix(AutoScrollSwitch.spec): do not get by text
---------
Co-authored-by: Danny Avila <messagedaniel@protonmail.com>
This commit is contained in:
parent
cff45df0ef
commit
b1a96ecedc
12 changed files with 158 additions and 37 deletions
|
|
@ -24,7 +24,7 @@ import useTimeout from './useTimeout';
|
|||
const AuthContext = createContext<TAuthContext | undefined>(undefined);
|
||||
|
||||
const AuthContextProvider = ({
|
||||
// authConfig,
|
||||
authConfig,
|
||||
children,
|
||||
}: {
|
||||
authConfig?: TAuthConfig;
|
||||
|
|
@ -98,6 +98,10 @@ const AuthContextProvider = ({
|
|||
}, [setUserContext, doSetError, logoutUser]);
|
||||
|
||||
const silentRefresh = useCallback(() => {
|
||||
if (authConfig?.test) {
|
||||
console.log('Test mode. Skipping silent refresh.');
|
||||
return;
|
||||
}
|
||||
refreshToken.mutate(undefined, {
|
||||
onSuccess: (data: TLoginResponse) => {
|
||||
const { user, token } = data;
|
||||
|
|
@ -105,11 +109,17 @@ const AuthContextProvider = ({
|
|||
setUserContext({ token, isAuthenticated: true, user });
|
||||
} else {
|
||||
console.log('Token is not present. User is not authenticated.');
|
||||
if (authConfig?.test) {
|
||||
return;
|
||||
}
|
||||
navigate('/login');
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
console.log('refreshToken mutation error:', error);
|
||||
if (authConfig?.test) {
|
||||
return;
|
||||
}
|
||||
navigate('/login');
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue