Skip to content

Commit

Permalink
Set default spanIndex based on spanId specified in URL hash, this sho…
Browse files Browse the repository at this point in the history
…uld scroll to the span, open up the span and highlight it
  • Loading branch information
mrajah-twttr committed Aug 21, 2020
1 parent 97bd788 commit 1564070
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zipkin-lens/src/components/TracePage/TraceSummary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ const TraceSummary = React.memo(({ traceSummary }) => {
const isRootedTrace = hasRootSpan(traceSummary.spans);
const [rootSpanIndex, setRootSpanIndex] = useState(0);
const isRerooted = rootSpanIndex !== 0;
const [currentSpanIndex, setCurrentSpanIndex] = useState(0);


// If spanId is present as hash (subresource) make that the spanIndex to load
const getSpanIndexOnLoad = window.location.hash !== "" ?
findSpanIndex(traceSummary.spans, window.location.hash.substring(1)) : 0;

const [currentSpanIndex, setCurrentSpanIndex] = useState(getSpanIndexOnLoad);
const [childrenHiddenSpanIndices, setChildrenHiddenSpanIndices] = useState(
{},
);
Expand Down

0 comments on commit 1564070

Please sign in to comment.