Skip to content

fix: use cache key for side-by-side toggle instead of clearing cache#77

Merged
dlvhdr merged 5 commits intodlvhdr:mainfrom
pablospe:side-by-side-cache
Feb 6, 2026
Merged

fix: use cache key for side-by-side toggle instead of clearing cache#77
dlvhdr merged 5 commits intodlvhdr:mainfrom
pablospe:side-by-side-cache

Conversation

@pablospe
Copy link
Contributor

@pablospe pablospe commented Feb 1, 2026

Summary

Follow-up to #75 — implements the cache key approach as suggested.

  • Include side-by-side mode in the diff cache key (path vs path:sbs) so both renders are cached separately — toggling with s is instant after the first render
  • Invalidate cache on resize since diffs are width-dependent

Test plan

  • Toggle side-by-side with s on a file, verify it re-renders
  • Toggle back, verify it's instant (cache hit)
  • Navigate to another file, come back, verify cache still works
  • Resize the terminal, verify diff re-renders at the new width

When toggling side-by-side, cache both renders under separate keys
(path vs path:sbs) so switching modes is instant after the first render.
The cached diffs are rendered at a specific width, so they must be
discarded when the terminal is resized.
Remove stale sideBySidePreference reference, vpHeight() call, and
redundant cache clearing in SetSideBySide that was defeating the
cache key approach.
@dlvhdr dlvhdr merged commit 89fce8d into dlvhdr:main Feb 6, 2026
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Feb 9, 2026
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [dlvhdr/diffnav](https://github.com/dlvhdr/diffnav) | minor | `v0.8.1` → `v0.9.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>dlvhdr/diffnav (dlvhdr/diffnav)</summary>

### [`v0.9.0`](https://github.com/dlvhdr/diffnav/releases/tag/v0.9.0)

[Compare Source](dlvhdr/diffnav@v0.8.2...v0.9.0)

#### Changelog

- [`3da3297`](dlvhdr/diffnav@3da3297) feat: floating help menu ([#&#8203;85](dlvhdr/diffnav#85))

### [`v0.8.2`](https://github.com/dlvhdr/diffnav/releases/tag/v0.8.2)

[Compare Source](dlvhdr/diffnav@v0.8.1...v0.8.2)

#### Changelog

- [`e95cea2`](dlvhdr/diffnav@e95cea2) fix: only log errors to stderr if not debug mode ([#&#8203;84](dlvhdr/diffnav#84))
- [`89fce8d`](dlvhdr/diffnav@89fce8d) fix: use cache key for side-by-side toggle instead of clearing cache ([#&#8203;77](dlvhdr/diffnav#77))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Ni4wIiwidXBkYXRlZEluVmVyIjoiNDIuOTYuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
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.

2 participants