Skip to content

fix(file-panel): guard update_components against nil render_data#75

Merged
dlyongemallo merged 1 commit intomainfrom
guard_nil_render_data
Mar 31, 2026
Merged

fix(file-panel): guard update_components against nil render_data#75
dlyongemallo merged 1 commit intomainfrom
guard_nil_render_data

Conversation

@dlyongemallo
Copy link
Copy Markdown
Owner

@dlyongemallo dlyongemallo commented Mar 31, 2026

Fixes #74.

Relates to sindrets#303.

Copilot AI review requested due to automatic review settings March 31, 2026 08:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Guards FilePanel:update_components() against being called before the panel buffer is initialized (e.g., when file_panel.show=false), and adds functional coverage for the “panel never opened” lifecycle to ensure these calls don’t error.

Changes:

  • Add an early-return guard in FilePanel:update_components() when self.render_data is nil.
  • Add functional tests covering FilePanel methods when the panel has not been opened/initialized, plus toggling on/off behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lua/diffview/scene/views/diff/file_panel.lua Adds a nil-guard so update_components() is safe when the panel hasn’t initialized its buffer/render state.
lua/diffview/tests/functional/panel_spec.lua Adds functional tests for the show=false lifecycle to prevent regressions around uninitialized panel state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lua/diffview/tests/functional/panel_spec.lua Outdated
@dlyongemallo dlyongemallo force-pushed the guard_nil_render_data branch from 4c453a2 to 4da325f Compare March 31, 2026 08:47
@dlyongemallo dlyongemallo merged commit 2b0fa22 into main Mar 31, 2026
2 checks passed
@dlyongemallo dlyongemallo deleted the guard_nil_render_data branch March 31, 2026 08:50
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.

[Bug] :DiffViewOpen fails when file_panel = { show=false } in config

2 participants