diff --git a/cmd/root.go b/cmd/root.go index 93ade24f..cc4e9da5 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -48,7 +48,7 @@ func Execute() { } } -func createModel(repoPath *string, configPath string, debug bool) (ui.Model, *os.File) { +func createModel(repoPath string, configPath string, debug bool) (ui.Model, *os.File) { var loggerFile *os.File if debug { @@ -60,8 +60,8 @@ func createModel(repoPath *string, configPath string, debug bool) (ui.Model, *os log.SetReportCaller(true) log.SetLevel(log.DebugLevel) log.Debug("Logging to debug.log") - if repoPath != nil { - log.Debug("Running in repo", "repo", *repoPath) + if repoPath != "" { + log.Debug("Running in repo", "repo", repoPath) } } else { loggerFile, _ = tea.LogToFile("debug.log", "debug") @@ -128,17 +128,16 @@ func init() { ) rootCmd.Run = func(_ *cobra.Command, args []string) { - var repo *string + var repo string repos := config.IsFeatureEnabled(config.FF_REPO_VIEW) if repos && len(args) > 0 { - repo = &args[0] + repo = args[0] } - if repo == nil { + if repo == "" { r, err := git.GetRepoInPwd() if err == nil && r != nil { - p := r.Path() - repo = &p + repo = r.Path() } } debug, err := rootCmd.Flags().GetBool("debug") diff --git a/config/parser.go b/config/parser.go index b30b52f3..92cf691e 100644 --- a/config/parser.go +++ b/config/parser.go @@ -365,7 +365,7 @@ func (parser ConfigParser) createConfigFileIfMissing( return nil } -func (parser ConfigParser) getDefaultConfigFileOrCreateIfMissing(repoPath *string) (string, error) { +func (parser ConfigParser) getDefaultConfigFileOrCreateIfMissing(repoPath string) (string, error) { var configFilePath string ghDashConfig := os.Getenv("GH_DASH_CONFIG") @@ -373,8 +373,8 @@ func (parser ConfigParser) getDefaultConfigFileOrCreateIfMissing(repoPath *strin if ghDashConfig != "" { configFilePath = ghDashConfig // Then try to see if we're currently in a git repo - } else if repoPath != nil { - basename := *repoPath + "/." + DashDir + } else if repoPath != "" { + basename := repoPath + "/." + DashDir repoConfigYml := basename + ".yml" repoConfigYaml := basename + ".yaml" if _, err := os.Stat(repoConfigYml); err == nil { @@ -463,7 +463,7 @@ func initParser() ConfigParser { return ConfigParser{} } -func ParseConfig(path string, repoPath *string) (Config, error) { +func ParseConfig(path string, repoPath string) (Config, error) { parser := initParser() var config Config diff --git a/ui/components/branchsidebar/branchsidebar.go b/ui/components/branchsidebar/branchsidebar.go index 3cb91c6b..e0ae5f4f 100644 --- a/ui/components/branchsidebar/branchsidebar.go +++ b/ui/components/branchsidebar/branchsidebar.go @@ -19,7 +19,7 @@ type Model struct { status *gitm.NameStatus } -func NewModel(ctx context.ProgramContext) Model { +func NewModel(ctx *context.ProgramContext) Model { return Model{ branch: nil, } @@ -86,7 +86,7 @@ func (m *Model) SetRow(b *branch.BranchData) tea.Cmd { } func (m *Model) refreshBranchStatusCmd() tea.Msg { - status, err := git.GetStatus(*m.ctx.RepoPath) + status, err := git.GetStatus(m.ctx.RepoPath) if err != nil { return nil } diff --git a/ui/components/footer/footer.go b/ui/components/footer/footer.go index 3e656207..267143f5 100644 --- a/ui/components/footer/footer.go +++ b/ui/components/footer/footer.go @@ -25,14 +25,14 @@ type Model struct { ShowConfirmQuit bool } -func NewModel(ctx context.ProgramContext) Model { +func NewModel(ctx *context.ProgramContext) Model { help := bbHelp.New() help.ShowAll = true help.Styles = ctx.Styles.Help.BubbleStyles l := "" r := "" return Model{ - ctx: &ctx, + ctx: ctx, help: help, leftSection: &l, rightSection: &r, @@ -70,7 +70,7 @@ func (m Model) View() string { Foreground(m.ctx.Theme.SelectedBackground). Padding(0, 1). Render("? help") - viewSwitcher := m.renderViewSwitcher(*m.ctx) + viewSwitcher := m.renderViewSwitcher(m.ctx) leftSection := "" if m.leftSection != nil { leftSection = *m.leftSection @@ -116,7 +116,7 @@ func (m *Model) UpdateProgramContext(ctx *context.ProgramContext) { m.help.Styles = ctx.Styles.Help.BubbleStyles } -func (m *Model) renderViewSwitcher(ctx context.ProgramContext) string { +func (m *Model) renderViewSwitcher(ctx *context.ProgramContext) string { var view string if ctx.View == config.PRsView { view += " PRs" @@ -124,11 +124,10 @@ func (m *Model) renderViewSwitcher(ctx context.ProgramContext) string { view += " Issues" } else if ctx.View == config.RepoView { repo := m.ctx.RepoPath - if m.ctx.RepoUrl != nil { - shortName := git.GetRepoShortName(*m.ctx.RepoUrl) - repo = &shortName + if m.ctx.RepoUrl != "" { + repo = git.GetRepoShortName(m.ctx.RepoUrl) } - view += fmt.Sprintf(" %s", *repo) + view += fmt.Sprintf(" %s", repo) } var user string diff --git a/ui/components/issuesidebar/issuesidebar.go b/ui/components/issuesidebar/issuesidebar.go index 99e7d662..dd089398 100644 --- a/ui/components/issuesidebar/issuesidebar.go +++ b/ui/components/issuesidebar/issuesidebar.go @@ -30,8 +30,8 @@ type Model struct { inputBox inputbox.Model } -func NewModel(ctx context.ProgramContext) Model { - inputBox := inputbox.NewModel(&ctx) +func NewModel(ctx *context.ProgramContext) Model { + inputBox := inputbox.NewModel(ctx) inputBox.SetHeight(common.InputBoxHeight) return Model{ diff --git a/ui/components/issuessection/issuessection.go b/ui/components/issuessection/issuessection.go index 3138db36..b8b38a7a 100644 --- a/ui/components/issuessection/issuessection.go +++ b/ui/components/issuessection/issuessection.go @@ -325,7 +325,7 @@ func (m *Model) ResetRows() { } func FetchAllSections( - ctx context.ProgramContext, + ctx *context.ProgramContext, ) (sections []section.Section, fetchAllCmd tea.Cmd) { sectionConfigs := ctx.Config.IssuesSections fetchIssuesCmds := make([]tea.Cmd, 0, len(sectionConfigs)) @@ -333,7 +333,7 @@ func FetchAllSections( for i, sectionConfig := range sectionConfigs { sectionModel := NewModel( i+1, - &ctx, + ctx, sectionConfig, time.Now(), ) // 0 is the search section diff --git a/ui/components/prsidebar/prsidebar.go b/ui/components/prsidebar/prsidebar.go index 30e99848..24232584 100644 --- a/ui/components/prsidebar/prsidebar.go +++ b/ui/components/prsidebar/prsidebar.go @@ -31,8 +31,8 @@ type Model struct { inputBox inputbox.Model } -func NewModel(ctx context.ProgramContext) Model { - inputBox := inputbox.NewModel(&ctx) +func NewModel(ctx *context.ProgramContext) Model { + inputBox := inputbox.NewModel(ctx) inputBox.SetHeight(common.InputBoxHeight) return Model{ @@ -320,9 +320,7 @@ func (m *Model) SetRow(d *data.PullRequestData) { if d == nil { m.pr = nil } else { - // TODO: understand why not copying the ctx to a new var — causes a memory leak - c := *m.ctx - m.pr = &pr.PullRequest{Ctx: &c, Data: d} + m.pr = &pr.PullRequest{Ctx: m.ctx, Data: d} } } diff --git a/ui/components/prssection/prssection.go b/ui/components/prssection/prssection.go index 11119fae..12a0eb08 100644 --- a/ui/components/prssection/prssection.go +++ b/ui/components/prssection/prssection.go @@ -433,7 +433,7 @@ func (m *Model) ResetRows() { } func FetchAllSections( - ctx context.ProgramContext, + ctx *context.ProgramContext, prs []section.Section, ) (sections []section.Section, fetchAllCmd tea.Cmd) { fetchPRsCmds := make([]tea.Cmd, 0, len(ctx.Config.PRSections)) @@ -441,7 +441,7 @@ func FetchAllSections( for i, sectionConfig := range ctx.Config.PRSections { sectionModel := NewModel( i+1, // 0 is the search section - &ctx, + ctx, sectionConfig, time.Now(), ) diff --git a/ui/components/reposection/commands.go b/ui/components/reposection/commands.go index 46218ae3..9ae66871 100644 --- a/ui/components/reposection/commands.go +++ b/ui/components/reposection/commands.go @@ -40,7 +40,7 @@ func (m *Model) fastForward() (tea.Cmd, error) { startCmd := m.Ctx.StartTask(task) return tea.Batch(startCmd, func() tea.Msg { var err error - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } @@ -62,7 +62,7 @@ func (m *Model) fastForward() (tea.Cmd, error) { if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } - repo, err = git.GetRepo(*m.Ctx.RepoPath) + repo, err = git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } @@ -108,14 +108,14 @@ func (m *Model) push(opts pushOptions) (tea.Cmd, error) { if len(b.Data.Remotes) == 0 { args = append(args, "--set-upstream") err = gitm.Push( - *m.Ctx.RepoPath, + m.Ctx.RepoPath, "origin", b.Data.Name, gitm.PushOptions{CommandOptions: gitm.CommandOptions{Args: args}}, ) } else { err = gitm.Push( - *m.Ctx.RepoPath, + m.Ctx.RepoPath, b.Data.Remotes[0], b.Data.Name, gitm.PushOptions{CommandOptions: gitm.CommandOptions{Args: args}}, @@ -124,7 +124,7 @@ func (m *Model) push(opts pushOptions) (tea.Cmd, error) { if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } @@ -152,11 +152,11 @@ func (m *Model) checkout() (tea.Cmd, error) { } startCmd := m.Ctx.StartTask(task) return tea.Batch(startCmd, func() tea.Msg { - err := gitm.Checkout(*m.Ctx.RepoPath, b.Data.Name) + err := gitm.Checkout(m.Ctx.RepoPath, b.Data.Name) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } @@ -179,7 +179,7 @@ type repoMsg struct { func (m *Model) readRepoCmd() []tea.Cmd { cmds := make([]tea.Cmd, 0) branchesTaskId := fmt.Sprintf("fetching_branches_%d", time.Now().Unix()) - if m.Ctx.RepoPath != nil { + if m.Ctx.RepoPath != "" { branchesTask := context.Task{ Id: branchesTaskId, StartText: "Reading local branches", @@ -191,7 +191,7 @@ func (m *Model) readRepoCmd() []tea.Cmd { cmds = append(cmds, bCmd) } cmds = append(cmds, func() tea.Msg { - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: branchesTaskId, Err: err} } @@ -209,7 +209,7 @@ func (m *Model) readRepoCmd() []tea.Cmd { func (m *Model) fetchRepoCmd() []tea.Cmd { cmds := make([]tea.Cmd, 0) fetchTaskId := fmt.Sprintf("git_fetch_repo_%d", time.Now().Unix()) - if m.Ctx.RepoPath == nil { + if m.Ctx.RepoPath == "" { return []tea.Cmd{} } fetchTask := context.Task{ @@ -221,7 +221,7 @@ func (m *Model) fetchRepoCmd() []tea.Cmd { } cmds = append(cmds, m.Ctx.StartTask(fetchTask)) cmds = append(cmds, func() tea.Msg { - repo, err := git.FetchRepo(*m.Ctx.RepoPath) + repo, err := git.FetchRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: fetchTaskId, Err: err} } @@ -251,7 +251,7 @@ func (m *Model) fetchPRsCmd() tea.Cmd { if limit == nil { limit = &m.Ctx.Config.Defaults.PrsLimit } - res, err := data.FetchPullRequests(fmt.Sprintf("author:@me repo:%s", git.GetRepoShortName(*m.Ctx.RepoUrl)), *limit, nil) + res, err := data.FetchPullRequests(fmt.Sprintf("author:@me repo:%s", git.GetRepoShortName(m.Ctx.RepoUrl)), *limit, nil) if err != nil { return constants.TaskFinishedMsg{ SectionId: 0, @@ -285,7 +285,7 @@ func (m *Model) fetchPRCmd(branch string) []tea.Cmd { } startCmd := m.Ctx.StartTask(task) return []tea.Cmd{startCmd, func() tea.Msg { - res, err := data.FetchPullRequests(fmt.Sprintf("author:@me repo:%s head:%s", git.GetRepoShortName(*m.Ctx.RepoUrl), branch), 1, nil) + res, err := data.FetchPullRequests(fmt.Sprintf("author:@me repo:%s head:%s", git.GetRepoShortName(m.Ctx.RepoUrl), branch), 1, nil) log.Debug("Fetching PRs", "res", res) if err != nil { return constants.TaskFinishedMsg{ @@ -385,11 +385,11 @@ func (m *Model) deleteBranch() tea.Cmd { } startCmd := m.Ctx.StartTask(task) return tea.Batch(startCmd, func() tea.Msg { - err := gitm.DeleteBranch(*m.Ctx.RepoPath, b.Data.Name, gitm.DeleteBranchOptions{Force: true}) + err := gitm.DeleteBranch(m.Ctx.RepoPath, b.Data.Name, gitm.DeleteBranchOptions{Force: true}) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } @@ -415,11 +415,11 @@ func (m *Model) newBranch(name string) tea.Cmd { } startCmd := m.Ctx.StartTask(task) return tea.Batch(startCmd, func() tea.Msg { - err := gitm.Checkout(*m.Ctx.RepoPath, name, gitm.CheckoutOptions{BaseBranch: m.repo.HeadBranchName}) + err := gitm.Checkout(m.Ctx.RepoPath, name, gitm.CheckoutOptions{BaseBranch: m.repo.HeadBranchName}) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } - repo, err := git.GetRepo(*m.Ctx.RepoPath) + repo, err := git.GetRepo(m.Ctx.RepoPath) if err != nil { return constants.TaskFinishedMsg{TaskId: taskId, Err: err} } diff --git a/ui/components/reposection/reposection.go b/ui/components/reposection/reposection.go index d2a7374e..cb2f7786 100644 --- a/ui/components/reposection/reposection.go +++ b/ui/components/reposection/reposection.go @@ -233,7 +233,7 @@ func (m *Model) View() string { } return m.Ctx.Styles.Section.ContainerStyle.Render( - lipgloss.JoinVertical(lipgloss.Left, m.SearchBar.View(*m.Ctx), view), + lipgloss.JoinVertical(lipgloss.Left, m.SearchBar.View(m.Ctx), view), ) } @@ -470,7 +470,7 @@ func (m *Model) FetchNextPageSectionRows() []tea.Cmd { } var cmds []tea.Cmd - if m.Ctx.RepoPath != nil { + if m.Ctx.RepoPath != "" { cmds = append(cmds, m.readRepoCmd()...) cmds = append(cmds, m.fetchRepoCmd()...) cmds = append(cmds, m.fetchPRsCmd()) @@ -479,7 +479,7 @@ func (m *Model) FetchNextPageSectionRows() []tea.Cmd { return cmds } -func FetchAllBranches(ctx context.ProgramContext) (Model, tea.Cmd) { +func FetchAllBranches(ctx *context.ProgramContext) (Model, tea.Cmd) { cmds := make([]tea.Cmd, 0) t := config.RepoView @@ -489,13 +489,13 @@ func FetchAllBranches(ctx context.ProgramContext) (Model, tea.Cmd) { } m := NewModel( 0, - &ctx, + ctx, cfg, time.Now(), ) m.refreshId = nextID() - if ctx.RepoPath != nil { + if ctx.RepoPath != "" { cmds = append(cmds, m.readRepoCmd()...) cmds = append(cmds, m.fetchRepoCmd()...) cmds = append(cmds, m.fetchPRsCmd()) diff --git a/ui/components/search/search.go b/ui/components/search/search.go index 81061a63..f7bebf4f 100644 --- a/ui/components/search/search.go +++ b/ui/components/search/search.go @@ -55,7 +55,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { return m, cmd } -func (m Model) View(ctx context.ProgramContext) string { +func (m Model) View(ctx *context.ProgramContext) string { return lipgloss.NewStyle(). Width(ctx.MainContentWidth - 4). MaxHeight(3). diff --git a/ui/components/section/section.go b/ui/components/section/section.go index 64e4b719..fe954c2a 100644 --- a/ui/components/section/section.go +++ b/ui/components/section/section.go @@ -303,7 +303,7 @@ func (m *BaseModel) GetMainContent() string { } func (m *BaseModel) View() string { - search := m.SearchBar.View(*m.Ctx) + search := m.SearchBar.View(m.Ctx) return m.Ctx.Styles.Section.ContainerStyle.Render( lipgloss.JoinVertical( lipgloss.Left, diff --git a/ui/components/tabs/tabs.go b/ui/components/tabs/tabs.go index 98dbb559..7ebbe1c1 100644 --- a/ui/components/tabs/tabs.go +++ b/ui/components/tabs/tabs.go @@ -29,7 +29,7 @@ func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) { return m, nil } -func (m Model) View(ctx context.ProgramContext) string { +func (m Model) View(ctx *context.ProgramContext) string { sectionTitles := make([]string, 0, len(m.sectionsConfigs)) for i, section := range m.sectionsConfigs { title := section.Title diff --git a/ui/components/tasks/pr.go b/ui/components/tasks/pr.go index 235db4fe..cf6cdf50 100644 --- a/ui/components/tasks/pr.go +++ b/ui/components/tasks/pr.go @@ -82,7 +82,7 @@ func OpenBranchPR(ctx *context.ProgramContext, section SectionIdentifer, branch "--web", branch, "-R", - *ctx.RepoUrl, + ctx.RepoUrl, }, Section: section, StartText: fmt.Sprintf("Opening PR for branch %s", branch), @@ -210,7 +210,7 @@ func CreatePR(ctx *context.ProgramContext, section SectionIdentifer, branchName "--title", title, "-R", - *ctx.RepoUrl, + ctx.RepoUrl, ) taskId := fmt.Sprintf("create_pr_%s", title) diff --git a/ui/context/context.go b/ui/context/context.go index 652987c9..137af9bb 100644 --- a/ui/context/context.go +++ b/ui/context/context.go @@ -29,8 +29,8 @@ type Task struct { } type ProgramContext struct { - RepoPath *string - RepoUrl *string + RepoPath string + RepoUrl string User string ScreenHeight int ScreenWidth int diff --git a/ui/ui.go b/ui/ui.go index af4660cc..715b15fb 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -48,12 +48,12 @@ type Model struct { prs []section.Section issues []section.Section tabs tabs.Model - ctx context.ProgramContext + ctx *context.ProgramContext taskSpinner spinner.Model tasks map[string]context.Task } -func NewModel(repoPath *string, configPath string) Model { +func NewModel(repoPath string, configPath string) Model { taskSpinner := spinner.Model{Spinner: spinner.Dot} m := Model{ keys: keys.Keys, @@ -62,7 +62,7 @@ func NewModel(repoPath *string, configPath string) Model { tasks: map[string]context.Task{}, } - m.ctx = context.ProgramContext{ + m.ctx = &context.ProgramContext{ RepoPath: repoPath, ConfigPath: configPath, StartTask: func(task context.Task) tea.Cmd { @@ -83,7 +83,7 @@ func NewModel(repoPath *string, configPath string) Model { m.prSidebar = prsidebar.NewModel(m.ctx) m.issueSidebar = issuesidebar.NewModel(m.ctx) m.branchSidebar = branchsidebar.NewModel(m.ctx) - m.tabs = tabs.NewModel(&m.ctx) + m.tabs = tabs.NewModel(m.ctx) return m } @@ -119,14 +119,14 @@ func (m *Model) initScreen() tea.Msg { return initMsg{Config: cfg} } - var url *string - if config.IsFeatureEnabled(config.FF_REPO_VIEW) && m.ctx.RepoPath != nil { - res, err := git.GetOriginUrl(*m.ctx.RepoPath) + var url string + if config.IsFeatureEnabled(config.FF_REPO_VIEW) && m.ctx.RepoPath != "" { + res, err := git.GetOriginUrl(m.ctx.RepoPath) if err != nil { showError(err) return initMsg{Config: cfg} } - url = &res + url = res } err = keys.Rebind( @@ -321,7 +321,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.ctx.View = m.switchSelectedView() m.syncMainContentWidth() m.setCurrSectionId(m.getCurrentViewDefaultSection()) - m.tabs.UpdateSectionsConfigs(&m.ctx) + m.tabs.UpdateSectionsConfigs(m.ctx) currSections := m.getCurrentViewSections() if len(currSections) == 0 { @@ -408,7 +408,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.ctx.View = m.switchSelectedView() m.syncMainContentWidth() m.setCurrSectionId(m.getCurrentViewDefaultSection()) - m.tabs.UpdateSectionsConfigs(&m.ctx) + m.tabs.UpdateSectionsConfigs(m.ctx) currSections := m.getCurrentViewSections() if len(currSections) == 0 { @@ -465,7 +465,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.ctx.View = m.switchSelectedView() m.syncMainContentWidth() m.setCurrSectionId(m.getCurrentViewDefaultSection()) - m.tabs.UpdateSectionsConfigs(&m.ctx) + m.tabs.UpdateSectionsConfigs(m.ctx) currSections := m.getCurrentViewSections() if len(currSections) == 0 { @@ -486,7 +486,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.ctx.View = m.ctx.Config.Defaults.View m.currSectionId = m.getCurrentViewDefaultSection() m.sidebar.IsOpen = msg.Config.Defaults.Preview.Open - m.tabs.UpdateSectionsConfigs(&m.ctx) + m.tabs.UpdateSectionsConfigs(m.ctx) m.syncMainContentWidth() newSections, fetchSectionsCmds := m.fetchAllViewSections() m.setCurrentViewSections(newSections) @@ -649,7 +649,7 @@ func (m Model) View() string { type initMsg struct { Config config.Config - RepoUrl *string + RepoUrl string } func (m *Model) setCurrSectionId(newSectionId int) { @@ -677,13 +677,13 @@ func (m *Model) onWindowSizeChanged(msg tea.WindowSizeMsg) { func (m *Model) syncProgramContext() { for _, section := range m.getCurrentViewSections() { - section.UpdateProgramContext(&m.ctx) + section.UpdateProgramContext(m.ctx) } - m.footer.UpdateProgramContext(&m.ctx) - m.sidebar.UpdateProgramContext(&m.ctx) - m.prSidebar.UpdateProgramContext(&m.ctx) - m.issueSidebar.UpdateProgramContext(&m.ctx) - m.branchSidebar.UpdateProgramContext(&m.ctx) + m.footer.UpdateProgramContext(m.ctx) + m.sidebar.UpdateProgramContext(m.ctx) + m.prSidebar.UpdateProgramContext(m.ctx) + m.issueSidebar.UpdateProgramContext(m.ctx) + m.branchSidebar.UpdateProgramContext(m.ctx) } func (m *Model) updateSection(id int, sType string, msg tea.Msg) (cmd tea.Cmd) { @@ -792,7 +792,7 @@ func (m *Model) setCurrentViewSections(newSections []section.Section) { if m.ctx.View == config.PRsView { search := prssection.NewModel( 0, - &m.ctx, + m.ctx, config.PrsSectionConfig{ Title: "", Filters: "archived:false", @@ -803,7 +803,7 @@ func (m *Model) setCurrentViewSections(newSections []section.Section) { } else { search := issuessection.NewModel( 0, - &m.ctx, + m.ctx, config.IssuesSectionConfig{ Title: "", Filters: "",