Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
Fix latestCommitHash not updating when a failed commit is removed
Claude9a88e127cae2
diff --git a/frontend/src/store/project-store.ts b/frontend/src/store/project-store.tsindex 429f3c8b..3a4aa9e0 100644--- a/frontend/src/store/project-store.ts+++ b/frontend/src/store/project-store.ts@@ -139,9 +139,17 @@ export const useProjectStore = create<ProjectStore>((set) => ({},removeCommit: (hash: CommitHash) => {set((state) => {+ const removedCommit = state.commits[hash];const newCommits = { ...state.commits };delete newCommits[hash];- return { commits: newCommits };++ // If removing the latest commit, fall back to its parent+ const newLatestCommitHash =+ state.latestCommitHash === hash+ ? (removedCommit?.parentHash ?? null)+ : state.latestCommitHash;++ return { commits: newCommits, latestCommitHash: newLatestCommitHash };});},resetCommits: () => set({ commits: {}, latestCommitHash: null }),