Skip to content

Commit

Permalink
Store preferred span name column width in localStorage (#965)
Browse files Browse the repository at this point in the history
Different developers tend to look at different kinds of traces, meaning
that they often prefer some set width of span name column in trace view.

Without this patch, the width is set at 25% and it resets on refresh.

With this patch the width is remembered in localStorage and preserved
on refresh, making it less necessary to adjust.

Signed-off-by: Ivan Babrou <github@ivan.computer>

Co-authored-by: Yuri Shkuro <yurishkuro@users.noreply.github.com>
  • Loading branch information
bobrik and yurishkuro committed Jun 24, 2022
1 parent ec17f78 commit df426d5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function newInitialState(): TTraceTimeline {
detailStates: new Map(),
hoverIndentGuideIds: new Set(),
shouldScrollToFirstUiFindMatch: false,
spanNameColumnWidth: 0.25,
spanNameColumnWidth: parseFloat(localStorage.getItem('spanNameColumnWidth') || '0.25'),
traceID: null,
};
}
Expand Down Expand Up @@ -162,6 +162,7 @@ function setTrace(state: TTraceTimeline, { uiFind, trace }: TTraceUiFindValue) {
}

function setColumnWidth(state: TTraceTimeline, { width }: TWidthValue): TTraceTimeline {
localStorage.setItem('spanNameColumnWidth', width.toString());
return { ...state, spanNameColumnWidth: width };
}

Expand Down

0 comments on commit df426d5

Please sign in to comment.