Skip to content

Commit

Permalink
feat: allow disabling refetch interval with 0 value
Browse files Browse the repository at this point in the history
  • Loading branch information
dlvhdr committed Dec 20, 2024
1 parent 72b8e10 commit 6f85c20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/data/schemas/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ schematize:
default:
details: |
By default, the dashboard is configured to:
- Display the preview pane with a width of 50 columns for all work items.
- Only fetch 20 PRs and issues at a time for each section.
- Display the PRs view when the dashboard loads.
Expand Down Expand Up @@ -61,7 +61,7 @@ properties:
weight: 2
details: |
This setting defines how many PRs the dashboard should fetch for each section when:
- The dashboard first loads.
- The [sref:fetch interval] elapses.
- You navigate to the next PR in a table without another fetched PR to display.
Expand All @@ -80,7 +80,7 @@ properties:
weight: 3
details: |
This setting defines how many issues the dashboard should fetch for each section when:
- The dashboard first loads.
- The [sref:fetch interval] elapses.
- You navigate to the next issue in a table without another fetched issue to display.
Expand Down Expand Up @@ -146,14 +146,16 @@ properties:
By default, the dashboard refetches work items every 30 minutes.
To disable the refetching interval set it to 0.
You can always use the [refresh current section] or [refresh all sections] command to
refetch work items in the current view. If you change the search query for a view, the
dashboard fetches results for the updated query immediately.
[refresh current section]: /getting-started/keybindings/global/#refresh-current-section
[refresh all sections]: /getting-started/keybindings/global/#refresh-all-sections
type: integer
minimum: 1
minimum: 0
default: 30
dateFormat:
title: Date format
Expand Down
4 changes: 4 additions & 0 deletions ui/ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@ func fetchUser() tea.Msg {
type intervalRefresh time.Time

func (m *Model) doRefreshAtInterval() tea.Cmd {
if m.ctx.Config.Defaults.RefetchIntervalMinutes == 0 {
return nil
}

return tea.Tick(
time.Minute*time.Duration(m.ctx.Config.Defaults.RefetchIntervalMinutes),
func(t time.Time) tea.Msg {
Expand Down

0 comments on commit 6f85c20

Please sign in to comment.