Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new list #64

Merged
merged 12 commits into from
Apr 2, 2023
Merged

feat: new list #64

merged 12 commits into from
Apr 2, 2023

Conversation

caarlos0
Copy link
Owner

No description provided.

Signed-off-by: Carlos Alexandro Becker <[email protected]>
Signed-off-by: Carlos Alexandro Becker <[email protected]>
@Dieterbe
Copy link
Contributor

Dieterbe commented Apr 2, 2023

Not sure if this is still maintained, and i hope to hear from @caarlos0 about this PR,
but as an outsider looking at the code, and trying it out, it looks pretty good to me and just needs a bit more work.

It seems what is happening in this PR is:

  1. switch from using multiple models (with each their own event loop), to a single model, backed by a generic list library (https://pkg.go.dev/github.com/charmbracelet/bubbles/list), which seems much cleaner and better, and is more full-featured (e.g. we now have free pagination and could easily add filtering)
  2. resizing window now shows ellipsis at cutoff, however it has other rendering bugs, similar to Display issues when more than one screen #67, but Display issues when more than one screen #67 itself is fixed. it seems that if you have many more entries than your screen height can fit, it all works and renders fine (with pagination), but it does get messed up when you resize the screen.
  3. some dependencies were updated

main: image
this PR:
image

I do see 2 potential issues with this PR:

  1. due to a change in the Github API, it needs this tweak:
diff --git a/fork-cleaner.go b/fork-cleaner.go
index e094f60..5da6f52 100644
--- a/fork-cleaner.go
+++ b/fork-cleaner.go
@@ -78,6 +78,7 @@ func FindAllForks(
 			parent.GetName(),
 			parent.GetDefaultBranch(),
 			fmt.Sprintf("%s:%s", login, repo.GetDefaultBranch()),
+			&github.ListOptions{}, // note: without pagination, we are limited to 250 commits. but that's enough to get an idea
 		)
 		if err != nil {
 			return forks, fmt.Errorf("failed to compare repository with upstream: %s: %w", repo.GetFullName(), err)
  1. seems the Update() event loop can generate multiple commands which will execute concurrently
    and may race for access to the same structures?

@caarlos0 : does the above make sense? I would suggest to get this PR merged soon, as it is a fairly invasive change to the core of the app. I could tackle the 2 listed shortcomings, but the rendering is above my head (but i don't think that issue should block merging)

@caarlos0
Copy link
Owner Author

caarlos0 commented Apr 2, 2023

yes, things happen and I ended up no finishing this one... will try to revive it

Signed-off-by: Carlos A Becker <[email protected]>
Signed-off-by: Carlos A Becker <[email protected]>
Signed-off-by: Carlos A Becker <[email protected]>
@caarlos0
Copy link
Owner Author

caarlos0 commented Apr 2, 2023

hey @Dieterbe thanks for the comments

  1. yes, donee
  2. in theory, no, as we don't act on a pointer to the model, and return another model every time update runs... unless I'm somewhere changing it directly, if you see that please let me know...

in any case, will merge this, feel free to take a look if you want 🙏

thank you!

@caarlos0 caarlos0 marked this pull request as ready for review April 2, 2023 20:11
@caarlos0 caarlos0 changed the title wip: new list feat: new list Apr 2, 2023
@caarlos0 caarlos0 merged commit 394f437 into main Apr 2, 2023
@caarlos0 caarlos0 deleted the list branch April 2, 2023 20:11
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