Skip to content

Commit 252a8a2

Browse files
committed
Fixes graph resize flicker after Visual History toggle
- Keeps the graph mounted while timeline mode is shown, avoiding the remount cascade that caused a visible resize jump - Reasserts hidden styling where flex/grid display rules could override it, so the inactive pane stays out of layout
1 parent 498e9e1 commit 252a8a2

3 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/webviews/apps/plus/graph/graph-app.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,10 @@ export class GraphApp extends SignalWatcher(LitElement) {
424424
private renderGraphPaneContent() {
425425
const displayMode: GraphDisplayMode = this.graphState.displayMode ?? 'graph';
426426
const isTimeline = displayMode === 'timeline';
427+
// Always render the graph subtree to avoid the cascade of remounts (split-panels +
428+
// React root + GK GraphContainer) that produces a visible "smaller, then bigger"
429+
// resize when returning from Visual History. Mirrors the always-render pattern used
430+
// by `renderDetailsPanel`. Timeline still mounts/unmounts on demand.
427431
return html`
428432
<div class="graph__graph-pane-body">
429433
${when(
@@ -438,11 +442,10 @@ export class GraphApp extends SignalWatcher(LitElement) {
438442
@gl-graph-sidebar-display-mode-change=${this.handleDisplayModeChange}
439443
></gl-graph-sidebar>`,
440444
)}
441-
${isTimeline
442-
? html`<div class="graph__graph-content">${this.renderTimelineMain()}</div>`
443-
: this.graphState.config?.sidebar
444-
? this.renderSidebarSplit()
445-
: html`<div class="graph__graph-content">${this.renderGraphMain()}</div>`}
445+
${this.graphState.config?.sidebar
446+
? this.renderSidebarSplit(isTimeline)
447+
: html`<div class="graph__graph-content" ?hidden=${isTimeline}>${this.renderGraphMain()}</div>`}
448+
${isTimeline ? html`<div class="graph__graph-content">${this.renderTimelineMain()}</div>` : nothing}
446449
</div>
447450
`;
448451
}
@@ -456,12 +459,13 @@ export class GraphApp extends SignalWatcher(LitElement) {
456459
></gl-graph-timeline>`;
457460
}
458461

459-
private renderSidebarSplit() {
462+
private renderSidebarSplit(hidden = false) {
460463
const isOpen = (this.graphState.sidebarVisible ?? false) && this.graphState.activeSidebarPanel != null;
461464
const sidebarPosition = this.graphState.sidebarPosition ?? sidebarDefaultPct;
462465
const sidebarPinned = this.graphState.config?.sidebarPinned ?? true;
463466
return html`<gl-split-panel
464467
class="graph__sidebar-split"
468+
?hidden=${hidden}
465469
primary="start"
466470
mode=${sidebarPinned ? 'split' : 'overlay'}
467471
.position=${isOpen ? sidebarPosition : 0}

src/webviews/apps/plus/graph/graph.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,13 @@ web-graph {
13851385
flex: 1;
13861386
min-width: 0;
13871387
}
1388+
1389+
// Outer-document override of `:host { display: grid }` / `display: flex` —
1390+
// guarantees the graph subtree hides when timeline mode mounts a sibling.
1391+
.graph__sidebar-split[hidden],
1392+
.graph__graph-content[hidden] {
1393+
display: none !important;
1394+
}
13881395
}
13891396

13901397
&__graph-content {
@@ -1396,6 +1403,11 @@ web-graph {
13961403
position: relative;
13971404
z-index: 0;
13981405

1406+
// display: flex overrides the UA [hidden] rule; re-assert it.
1407+
&[hidden] {
1408+
display: none;
1409+
}
1410+
13991411
gl-graph-minimap-container {
14001412
position: relative;
14011413
// Above the gitkraken-components graph internals, which use z-indexes up to 16 —

src/webviews/apps/shared/components/split-panel/split-panel.css.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ export const splitPanelStyles = css`
2525
var(--gl-split-panel-divider-width, 4px) 1fr;
2626
}
2727
28+
/* :host { display: grid } overrides the UA [hidden] rule; re-assert it. */
29+
:host([hidden]) {
30+
display: none;
31+
}
32+
2833
:host([dragging]) {
2934
user-select: none;
3035
}

0 commit comments

Comments
 (0)