Skip to content

Commit 725addc

Browse files
committed
fix: issue with route and path
1 parent eddd63a commit 725addc

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

packages/scan/src/core/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ interface Monitor {
133133
interactions: Array<InternalInteraction>;
134134
session: ReturnType<typeof getSession>;
135135
url: string | null;
136-
apiKey: string | null;
137136
route: string | null;
138-
path: string | null;
137+
apiKey: string | null;
139138
commit: string | null;
140139
branch: string | null;
141140
}

packages/scan/src/core/monitor/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ export interface MonitoringWithoutRouteProps
4242
export const Monitoring = ({
4343
url,
4444
apiKey,
45-
path = null, // path passed down would be reactive
4645
params,
46+
path = null, // path passed down would be reactive
4747
route = null,
4848
commit = null,
4949
branch = null,
@@ -59,19 +59,18 @@ export const Monitoring = ({
5959
url,
6060
apiKey,
6161
route,
62-
path,
6362
commit,
6463
branch,
6564
};
65+
6666
// When using Monitoring without framework, we need to compute the route from the path and params
6767
if (!route && path && params) {
6868
Store.monitor.value.route = computeRoute(path, params);
6969
} else {
70-
Store.monitor.value.route = route ?? new URL(window.location.toString()).pathname;
70+
Store.monitor.value.route =
71+
route ?? path ?? new URL(window.location.toString()).pathname; // this is inaccurate on vanilla react if the path is not provided but used for session route
7172
}
7273

73-
Store.monitor.value.path = path ?? new URL(window.location.toString()).pathname;
74-
7574
// eslint-disable-next-line import/no-named-as-default-member
7675
React.useEffect(() => {
7776
scanMonitoring({ enabled: true });

0 commit comments

Comments
 (0)