Skip to content

Commit

Permalink
Store preferred span name column width in localStorage
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 <[email protected]>
  • Loading branch information
bobrik committed Jun 24, 2022
1 parent dad7c06 commit 718dbd6
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 718dbd6

Please sign in to comment.