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: showing a loading message #364

Merged
merged 6 commits into from
Jun 2, 2024
Merged

Conversation

kyu08
Copy link
Contributor

@kyu08 kyu08 commented May 19, 2024

Resolves #363

This is my first PR to gh-dash. So if I'm doing something wrong. Please let me know that. 😅

Summary

Show Loading... when gh-dash fetching PRs(not issues because the Tip is showed when issues are being fetched currently)

How did you test this change?

Verify Loading... is showed when:

  • gh-dash is launched
  • r key is pushed
  • R key is pushed

Images/Videos

Before

before.mov

After

after.mov

I considered to showing Loading... on sidebar too. But the message currently showed is suitable too. So I did not change it.

@@ -119,6 +119,7 @@ func (m Model) Update(msg tea.Msg) (section.Section, tea.Cmd) {
currIssue.Assignees.Nodes = removeAssignees(currIssue.Assignees.Nodes, msg.RemovedAssignees.Nodes)
}
m.Issues[i] = currIssue
m.Table.SetIsLoading(false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If L122 and L136 is not added, issues can not be shown because Loading... is showed always.

Comment on lines 222 to 224
if m.isLoading {
return bodyStyle.Render(m.loadingMessage)
}
Copy link
Owner

Choose a reason for hiding this comment

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

If you're up for it, let's make a bit more fancy.
You can add a padding of 1 to the left (I think) and it should center it better.
Also, you can add a spinner to it's left with "github.com/charmbracelet/bubbles/spinner". You can see an example in https://github.com/charmbracelet/bubbletea/tree/master/examples/spinner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for taking time for this PR!
Wow, this spinner is great! I'll try to do it!

Copy link
Contributor Author

@kyu08 kyu08 May 25, 2024

Choose a reason for hiding this comment

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

@dlvhdr

I tried in c2f2405.
But the spinner does not work.
I will try to fix later.
If you have an idea please let me know.

Untitled.mov

Copy link
Contributor Author

@kyu08 kyu08 May 26, 2024

Choose a reason for hiding this comment

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

I tried in c2f2405.
But the spinner does not work.
I will try to fix later.
If you have an idea please let me know.

@dlvhdr
This problem has been fixed.
I added loadingSpinner, loadingSpinnerCmd := m.Table.LoadingSpinner.Update(msg) only to issuesection.go.
I have to add it to prsection.go as well. 😅

After I will been done with TODOs and review the code sanity, I will ask you to review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dlvhdr
I'm done with fixing.
Could you review this PR please?

@kyu08 kyu08 requested a review from dlvhdr May 26, 2024 13:50
@dlvhdr
Copy link
Owner

dlvhdr commented May 30, 2024

Thanks for working on this @kyu08, looks great!
Just a couple of comments:

  1. When I scroll to the end of a list, the behavior currently, is to fetch the next page of PRs/Issues. Right now it looks odd that the whole screen replaces with a loading message. I believe you can check whether we are fetching the first page or whether it's a pagination action. To see this, just have a query return more than 20 PRs and scroll to the bottom with G
  2. The color of the loading indicator should use the colors from the user's theme. I think ctx.Theme.SecondaryText could work well. WDYT?

@Omnikron13
Copy link
Contributor

I don't actually recall what it does atm with a long list... It paginates?

Wouldn't be it beter to behave like, say, vim and not actually highlight the bottom couple until it's actually the bottom couple? That's how most people configure their text editor, and I believe this behaviour is supported by native components isn't it?

@dlvhdr
Copy link
Owner

dlvhdr commented May 31, 2024

wdym @Omnikron13? Like vim's scrolloff?

@Omnikron13
Copy link
Contributor

Omnikron13 commented May 31, 2024 via email

@Omnikron13
Copy link
Contributor

My lax attitude to issues and PRs is rather why good tooling that doesn't make me leave the terminal to pleasantly interact with... well, practically every part of GitHub tbh. Spent literal a couple years using a daily driver that didn't even have X installed out a general preferences, and by god have things god notably more pleasant since then as well.

@kyu08
Copy link
Contributor Author

kyu08 commented Jun 1, 2024

@dlvhdr
The color issue has been fixed in 58e9fca.
The pagination issue has been fixed in b6d5806.

Could you review these changes please?

@dlvhdr
Copy link
Owner

dlvhdr commented Jun 1, 2024

Thanks for fixing my comments :)
I think there's another small bug, let me know if you want to fix it or land as is.
When refreshing every view with R (capital R) the spinner doesn't spin.

@kyu08
Copy link
Contributor Author

kyu08 commented Jun 2, 2024

@dlvhdr
Thanks for reviewing too!

I think there's another small bug, let me know if you want to fix it or land as is.
When refreshing every view with R (capital R) the spinner doesn't spin.

In my environment, I could not confirm reproduction.
Can you show me reproduction procedure please?

@dlvhdr
Copy link
Owner

dlvhdr commented Jun 2, 2024

Not near a computer right now but when you press R you can see the spinner properly working but then when you switch to the next section with l it stops.

@kyu08
Copy link
Contributor Author

kyu08 commented Jun 2, 2024

@dlvhdr

Thank you for letting me know how to repro.
Now I can repro on my environment too.

I took a look around the codes, but I couldn't identify the cause.

For now, how about we merge this PR and discuss this issue separately as you suggested?

@dlvhdr dlvhdr merged commit 9d27687 into dlvhdr:main Jun 2, 2024
2 checks passed
@dlvhdr
Copy link
Owner

dlvhdr commented Jun 2, 2024

Opened #386

@kyu08
Copy link
Contributor Author

kyu08 commented Jun 2, 2024

Thanks!
When I have enough time, I'll take a look at it.

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.

[Feature request] Showing a loading message when PRs / Issues are being fetched
3 participants