Skip to content

Commit 49e5698

Browse files
committed
fix: issue with route and path
1 parent b1facc2 commit 49e5698

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
@@ -131,9 +131,8 @@ interface Monitor {
131131
interactions: Array<InternalInteraction>;
132132
session: ReturnType<typeof getSession>;
133133
url: string | null;
134-
apiKey: string | null;
135134
route: string | null;
136-
path: string | null;
135+
apiKey: string | null;
137136
commit: string | null;
138137
branch: string | null;
139138
}

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)