From 6f85c20d5bcef6f0023bdeac42c4024254295889 Mon Sep 17 00:00:00 2001 From: Dolev Hadar Date: Fri, 20 Dec 2024 18:09:58 +0200 Subject: [PATCH] feat: allow disabling refetch interval with 0 value --- docs/data/schemas/defaults.yaml | 10 ++++++---- ui/ui.go | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/data/schemas/defaults.yaml b/docs/data/schemas/defaults.yaml index a4c26e07..cf7526b6 100644 --- a/docs/data/schemas/defaults.yaml +++ b/docs/data/schemas/defaults.yaml @@ -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. @@ -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. @@ -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. @@ -146,6 +146,8 @@ 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. @@ -153,7 +155,7 @@ properties: [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 diff --git a/ui/ui.go b/ui/ui.go index f81a9b3f..5aaae9ba 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -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 {