Skip to content

Conversation

@jonasehrlich
Copy link
Owner

This PR contains multiple changes, related to the Git status.

  • Update Git status API to contain more information
  • Handler for SSE requests that sends a Git status as a first message
  • Debounced file watcher on the repository sending updates through a std::sync::mpsc::channel
  • Receiver of the FS events in a tokio task that sends the current Git status through a tokio::sync::broadcast::channel to the individual event streams

On the client side there are also some changes:

  • Added status bar component that shows the current branch and added/renamed/changed/deleted files, this can be extended to solve all Git operations (pin, checkout, ...) in the future
  • Added Typesafe and reconnecting wrapper around the EventSource API - although we should evaluate if we switch to WebSockets in the future as SSE only supports 6 connections to one host per browser instance. Maybe this also does not matter as debug-flow would anyways fall apart with different flows in different tabs as the zustand stores would overwrite each other.
  • Added useEventStream hook to declare subscription to an event type

Closes #102

}
}

impl TryFrom<&Repository> for Status {
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I would probably prefer a method e.g. Status::try_from_repository in this case. As TryFrom is more about type conversions.
Alternatively we could just have an impl block:

impl Repository {
pub fn status() Result<Status> {
....
}
}

Copy link
Owner Author

Choose a reason for hiding this comment

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

used Status::try_from_repository I don't like to have all this logic in git2_ox::Repository

@@ -0,0 +1,54 @@
import log from "loglevel";
Copy link
Collaborator

@TobTheRock TobTheRock Aug 25, 2025

Choose a reason for hiding this comment

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

Don't want to introduce rxjs 👿 ?
Instead of implementing typed events and event stream by hand (or vibe)

Copy link
Owner Author

Choose a reason for hiding this comment

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

only halfway vibed 🗡️

I would need to read into rxjs

@TobTheRock TobTheRock self-requested a review August 25, 2025 13:41
@jonasehrlich jonasehrlich merged commit db39599 into main Aug 31, 2025
12 checks passed
@jonasehrlich jonasehrlich deleted the je/git-status-sse branch August 31, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git status watcher and permanent display

3 participants