mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix: improve OAuth dialog UX and fix session state management
- Add auto-start authorization for single-method OAuth providers - Fix optimistic message cleanup on error in useSendPrompt - Add JSON Pointer path decoding for validation errors - Improve OAuth dialog responsive layout and truncate long labels - Change onSuccess to onSettled for proper query invalidation
This commit is contained in:
1 parent
d19ebdd9e0
commit
6d961ccd72
3 files changed
+53
-21
No files matched your search
@@ -29,6 +29,8 @@ export function useTitleGenerating(sessionID: string | undefined) {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setIsGenerating(sessionID ? titleGeneratingSessionsState.has(sessionID) : false);
|
||||
|
||||
const listener = () => {
|
||||
setIsGenerating(sessionID ? titleGeneratingSessionsState.has(sessionID) : false);
|
||||
};
|
||||
@@ -155,7 +157,7 @@ export const useDeleteSession = (opcodeUrl: string | null | undefined, directory
|
||||
|
||||
return results
|
||||
},
|
||||
onSuccess: () => {
|
||||
onSettled: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ["opencode", "sessions", opcodeUrl, directory] });
|
||||
},
|
||||
});
|
||||
@@ -366,6 +368,12 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
|
||||
onError: (error, variables) => {
|
||||
const { sessionID } = variables;
|
||||
const messagesQueryKey = ["opencode", "messages", opcodeUrl, sessionID, directory];
|
||||
|
||||
setSessionStatus(sessionID, { type: "idle" });
|
||||
queryClient.setQueryData<MessageWithParts[]>(
|
||||
messagesQueryKey,
|
||||
(old) => old?.filter((msgWithParts) => !msgWithParts.info.id.startsWith("optimistic_")),
|
||||
);
|
||||
|
||||
const isNetworkError = error instanceof TypeError ||
|
||||
(error instanceof FetchError && error.code === 'TIMEOUT');
|
||||
@@ -381,12 +389,6 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
|
||||
return;
|
||||
}
|
||||
|
||||
setSessionStatus(sessionID, { type: "idle" });
|
||||
queryClient.setQueryData<MessageWithParts[]>(
|
||||
messagesQueryKey,
|
||||
(old) => old?.filter((msgWithParts) => !msgWithParts.info.id.startsWith("optimistic_")),
|
||||
);
|
||||
|
||||
const parsed = parseNetworkError(error);
|
||||
showToast.error(parsed.title, {
|
||||
description: parsed.message,
|
||||
|
||||
Reference in new issue
Block a user