Skip to content

Commit d612cfc

Browse files
committed
chore(Auth): reorder exports in Auth component
fix(PluginAuthForm): handle case when pluginKey is null or undefined fix(PluginStoreDialog): handle case when getAvailablePluginFromKey is null or undefined fix(AuthContext): make authConfig optional in AuthContextProvider feat(hooks): add useServerStream hook fix(conversation): setSubmission to null instead of empty object fix(preset): specify type for presets atom fix(search): specify type for isSearchEnabled atom fix(submission): specify type for submission atom
1 parent c40b95f commit d612cfc

File tree

9 files changed

+13
-12
lines changed

9 files changed

+13
-12
lines changed

client/src/components/Auth/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export { default as Login } from './Login';
22
export { default as Registration } from './Registration';
3-
export { default as RequestPasswordReset } from './RequestPasswordReset';
43
export { default as ResetPassword } from './ResetPassword';
4+
export { default as ApiErrorWatcher } from './ApiErrorWatcher';
5+
export { default as RequestPasswordReset } from './RequestPasswordReset';

client/src/components/Plugins/Store/PluginAuthForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function PluginAuthForm({ plugin, onSubmit }: TPluginAuthFormProps) {
2323
className="col-span-1 flex w-full flex-col items-start justify-start gap-2"
2424
method="POST"
2525
onSubmit={handleSubmit((auth) =>
26-
onSubmit({ pluginKey: plugin?.pluginKey, action: 'install', auth }),
26+
onSubmit({ pluginKey: plugin?.pluginKey ?? '', action: 'install', auth }),
2727
)}
2828
>
2929
{plugin?.authConfig?.map((config: TPluginAuthConfig, i: number) => (

client/src/components/Plugins/Store/PluginStoreDialog.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,9 @@ function PluginStoreDialog({ isOpen, setIsOpen }: TPluginStoreDialogProps) {
8484
const getAvailablePluginFromKey = availablePlugins?.find((p) => p.pluginKey === pluginKey);
8585
setSelectedPlugin(getAvailablePluginFromKey);
8686

87-
if (
88-
getAvailablePluginFromKey?.authConfig.length > 0 &&
89-
!getAvailablePluginFromKey?.authenticated
90-
) {
87+
const { authConfig, authenticated } = getAvailablePluginFromKey ?? {};
88+
89+
if (authConfig && authConfig.length > 0 && !authenticated) {
9190
setShowPluginAuthForm(true);
9291
} else {
9392
handleInstall({ pluginKey, action: 'install', auth: null });

client/src/hooks/AuthContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const AuthContextProvider = ({
4646
authConfig,
4747
children,
4848
}: {
49-
authConfig: TAuthConfig;
49+
authConfig?: TAuthConfig;
5050
children: ReactNode;
5151
}) => {
5252
const [user, setUser] = useState<TUser | undefined>(undefined);

client/src/hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ export { default as useLocalize } from './useLocalize';
77
export { default as useMediaQuery } from './useMediaQuery';
88
export { default as useSetOptions } from './useSetOptions';
99
export { default as useGenerations } from './useGenerations';
10+
export { default as useServerStream } from './useServerStream';
1011
export { default as useMessageHandler } from './useMessageHandler';

client/src/store/conversation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const messagesSiblingIdxFamily = atomFamily({
5151
const useConversation = () => {
5252
const setConversation = useSetRecoilState(conversation);
5353
const setMessages = useSetRecoilState<TMessagesAtom>(messages);
54-
const setSubmission = useSetRecoilState<TSubmission | object | null>(submission.submission);
54+
const setSubmission = useSetRecoilState<TSubmission | null>(submission.submission);
5555
const resetLatestMessage = useResetRecoilState(latestMessage);
5656

5757
const _switchToConversation = (
@@ -73,7 +73,7 @@ const useConversation = () => {
7373

7474
setConversation(conversation);
7575
setMessages(messages);
76-
setSubmission({});
76+
setSubmission({} as TSubmission);
7777
resetLatestMessage();
7878
};
7979

client/src/store/preset.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TPreset } from 'librechat-data-provider';
66
// an array of saved presets.
77
// sample structure
88
// [preset1, preset2, preset3]
9-
const presets = atom({
9+
const presets = atom<TPreset[]>({
1010
key: 'presets',
1111
default: [],
1212
});

client/src/store/search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { TMessage } from 'librechat-data-provider';
22
import { atom, selector } from 'recoil';
33
import { buildTree } from '~/utils';
44

5-
const isSearchEnabled = atom({
5+
const isSearchEnabled = atom<boolean | null>({
66
key: 'isSearchEnabled',
77
default: null,
88
});

client/src/store/submission.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { TSubmission } from 'librechat-data-provider';
1212
// isRegenerate=false, // isRegenerate?
1313
// }
1414

15-
const submission = atom<TSubmission | object | null>({
15+
const submission = atom<TSubmission | null>({
1616
key: 'submission',
1717
default: null,
1818
});

0 commit comments

Comments
 (0)