mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 23:47:12 +00:00
fix: traces back button issue (#8041)
Co-authored-by: Vishal Sharma <makeavish786@gmail.com>
This commit is contained in:
parent
85f04e4bae
commit
33e70d1f37
@ -42,7 +42,19 @@ function TraceMetadata(props: ITraceMetadataProps): JSX.Element {
|
||||
<Button className="previous-btn">
|
||||
<ArrowLeft
|
||||
size={14}
|
||||
onClick={(): void => history.push(ROUTES.TRACES_EXPLORER)}
|
||||
onClick={(): void => {
|
||||
// Check if page was opened in new tab (no referrer from same origin)
|
||||
// or if there's no meaningful history to go back to
|
||||
const hasValidReferrer =
|
||||
document.referrer &&
|
||||
new URL(document.referrer).origin === window.location.origin;
|
||||
|
||||
if (hasValidReferrer && window.history.length > 1) {
|
||||
history.goBack();
|
||||
} else {
|
||||
history.push(ROUTES.TRACES_EXPLORER);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Button>
|
||||
<div className="trace-name">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user