Skip to content

Commit 03cf233

Browse files
authored
fix(router): replace slashes in route ID for loader timing reporting (#7117)
1 parent b00922e commit 03cf233

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.changeset/heavy-days-kick.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@modern-js/runtime-utils': patch
3+
---
4+
5+
fix(router): replace slashes in route ID for loader timing reporting
6+
fix(router): 为 server timing 替换 route id 中的 "/"

packages/toolkit/runtime-utils/src/browser/nestedRoutes.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,10 @@ function createLoader(route: NestedRoute): LoaderFunction {
167167
const storage = getAsyncLocalStorage();
168168
storage
169169
?.useContext()
170-
.monitors?.timing(`${LOADER_REPORTER_NAME}-${route.id}`, cost);
170+
.monitors?.timing(
171+
`${LOADER_REPORTER_NAME}-${route.id?.replace(/\//g, '_')}`,
172+
cost,
173+
);
171174
}
172175
return res;
173176
};

0 commit comments

Comments
 (0)