From 8d0e5c6c34c5f1f2ebc29c9a6523f203ab3beebb Mon Sep 17 00:00:00 2001 From: "sp.wack" <83104063+amanape@users.noreply.github.com> Date: Mon, 12 May 2025 20:57:00 +0400 Subject: [PATCH] hotfix: Don't handle git changes side effect too frequently (#8451) --- frontend/src/hooks/query/use-get-git-changes.ts | 4 ++-- openhands/server/routes/files.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/hooks/query/use-get-git-changes.ts b/frontend/src/hooks/query/use-get-git-changes.ts index 1ae3819c40..a194340626 100644 --- a/frontend/src/hooks/query/use-get-git-changes.ts +++ b/frontend/src/hooks/query/use-get-git-changes.ts @@ -29,7 +29,7 @@ export const useGetGitChanges = () => { // Latest changes should be on top React.useEffect(() => { - if (result.data) { + if (!result.isFetching && result.isSuccess && result.data) { const currentData = result.data; // If this is new data (not the same reference as before) @@ -59,7 +59,7 @@ export const useGetGitChanges = () => { } } } - }, [result.data]); + }, [result.isFetching, result.isSuccess, result.data]); return { data: orderedChanges, diff --git a/openhands/server/routes/files.py b/openhands/server/routes/files.py index 9dd546cd5c..97800e7551 100644 --- a/openhands/server/routes/files.py +++ b/openhands/server/routes/files.py @@ -226,7 +226,7 @@ def zip_current_workspace(request: Request) -> FileResponse | JSONResponse: @app.get( '/git/changes', - response_model=dict[str, Any], + response_model=list[dict[str, str]], responses={ 404: {'description': 'Not a git repository', 'model': dict}, 500: {'description': 'Error getting changes', 'model': dict}, @@ -236,7 +236,7 @@ async def git_changes( request: Request, conversation_id: str, user_id: str = Depends(get_user_id), -) -> dict[str, Any] | JSONResponse: +) -> list[dict[str, str]] | JSONResponse: runtime: Runtime = request.state.conversation.runtime conversation_store = await ConversationStoreImpl.get_instance( config,