Skip to content

Conversation

@beNative
Copy link
Owner

Summary

  • keep repository status updates in sync with the latest repository snapshot so task completions do not overwrite edits

Testing

  • npm test
  • npm run build

Codex Task

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +44
const repositoriesRef = useRef<Repository[]>(repositories);

useEffect(() => {
repositoriesRef.current = repositories;
}, [repositories]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update ref synchronously to avoid lost edits

The new repositoriesRef is populated inside a useEffect, which only runs after the component renders. If a repository is saved (causing a re‑render) and a task finishes before this effect fires, updateRepoStatus will still read the stale array from before the edit and call updateRepository with that snapshot, overwriting the just-saved changes. To guarantee status updates always merge with the latest repository data, assign repositoriesRef.current = repositories during render (or use useLayoutEffect) so the ref is current before any async callbacks fire.

Useful? React with 👍 / 👎.

@beNative beNative merged commit 9d4346f into main Nov 12, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants