Skip to content

Fix pane widths not resetting when switching tabs across view modes#68

Merged
ThisIs-Developer merged 1 commit intoThisIs-Developer:mainfrom
jhrepo:fix/tab-view-mode-pane-reset
Apr 8, 2026
Merged

Fix pane widths not resetting when switching tabs across view modes#68
ThisIs-Developer merged 1 commit intoThisIs-Developer:mainfrom
jhrepo:fix/tab-view-mode-pane-reset

Conversation

@jhrepo
Copy link
Copy Markdown

@jhrepo jhrepo commented Apr 7, 2026

Bug

  1. Set Tab A to Preview mode
  2. Set Tab B to Split mode
  3. Switch back to Tab A

Expected: Full-width Preview mode.
Actual: Preview renders at 50% width, leaving the right half empty.

Root Cause

restoreViewMode() sets currentViewMode = null before calling setViewMode(), so previousMode is always null inside
setViewMode(). The previousMode === 'split' check never passes, resetPaneWidths() is never called, and the inline flex styles
from Split mode persist and override the CSS.

Fix

Changed else if (previousMode === 'split') to else so inline flex styles are always cleared when entering a non-split mode.

    if (mode === 'split') {
        applyPaneWidths();
-   } else if (previousMode === 'split') {
+   } else {
        resetPaneWidths();
    }

resetPaneWidths() only sets style.flex = '', which is a no-op when no inline styles exist. No side effects for other mode transitions.

When switching between tabs with different view modes (e.g., split and
preview), the inline flex styles from split mode were not being cleared.
This happened because restoreViewMode() sets currentViewMode to null
before calling setViewMode(), causing the previousMode === 'split'
check to always fail.

Changed the condition to always reset pane widths when entering a
non-split mode, regardless of the previous mode value.
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

Someone is attempting to deploy a commit to the ThisIs-Developer Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment Apr 8, 2026 4:01am

@ThisIs-Developer ThisIs-Developer merged commit 7e82536 into ThisIs-Developer:main Apr 8, 2026
3 of 4 checks passed
@ThisIs-Developer
Copy link
Copy Markdown
Owner

@jhrepo Thank you for your contribution, appreciate

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