Skip to content

Conversation

@nshcr
Copy link
Contributor

@nshcr nshcr commented Jan 9, 2026

Screen.Recording.2026-01-09.at.13.13.21.mov

This PR fixes a bug I mentioned in that issue (#11746) but didn't explain in detail.

In the branch tab, the persisted list mode state of the changed file preview for the selected branch did not correctly respond to branch switching, causing all branches to share the list mode state of the first selected branch (from the initial component initialization).

This is addressed by subscribing to the persisted store within the FileListMode component, ensuring that each branch maintains its own list mode state without affecting the others.

Although my proposal in that issue was to share state, I also believe that the state sharing fixed by this PR was clearly a bug. In this case, using isolated state aligns with the current expected behavior.

Copilot AI review requested due to automatic review settings January 9, 2026 07:44
@vercel
Copy link

vercel bot commented Jan 9, 2026

@nshcr is attempting to deploy a commit to the GitButler Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor

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

This PR fixes a state-sharing bug where the file list view mode (tree/list) for branches was incorrectly shared across all branches. Previously, the persisted store instance was created once and never updated when switching branches, causing all branches to use the first branch's list mode state.

The fix uses $derived to reactively get the correct persisted store instance when persistId changes, and subscribes to it in an $effect with proper cleanup handling.

@Caleb-T-Owens
Copy link
Contributor

Looks good to me, nice job spotting that 👍

@Caleb-T-Owens Caleb-T-Owens merged commit 72c2633 into gitbutlerapp:master Jan 9, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants