Skip to content

Commit

Permalink
ref: Use Proxy to track client-side load event route accesses (#10576)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 authored Aug 29, 2023
1 parent 489c642 commit 7670f86
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/weak-vans-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

fix: Use Proxy to track usage of client side load `event.route`
8 changes: 4 additions & 4 deletions packages/kit/src/runtime/client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,12 @@ export function create_client(app, target) {

/** @type {import('@sveltejs/kit').LoadEvent} */
const load_input = {
route: {
get id() {
route: new Proxy(route, {
get: (target, key) => {
uses.route = true;
return route.id;
return target[/** @type {'id'} */ (key)];
}
},
}),
params: new Proxy(params, {
get: (target, key) => {
uses.params.add(/** @type {string} */ (key));
Expand Down

0 comments on commit 7670f86

Please sign in to comment.