Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/clean-countries-push.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

Set \$page.url to current URL in browser
Comment thread
Rich-Harris marked this conversation as resolved.
Outdated
8 changes: 3 additions & 5 deletions packages/kit/src/runtime/client/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ export class Renderer {
* status: number;
* error: Error;
* nodes: Array<Promise<CSRComponent>>;
* url: URL;
* params: Record<string, string>;
* }} selected
*/
async start({ status, error, nodes, url, params }) {
async start({ status, error, nodes, params }) {
const url = new URL(location.href);

/** @type {Array<import('./types').BranchNode | undefined>} */
const branch = [];

Expand All @@ -211,9 +212,6 @@ export class Renderer {

let error_args;

// url.hash is empty when coming from the server
url.hash = window.location.hash;

try {
for (let i = 0; i < nodes.length; i += 1) {
const is_leaf = i === nodes.length - 1;
Expand Down
1 change: 0 additions & 1 deletion packages/kit/src/runtime/client/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { set_paths } from '../paths.js';
* status: number;
* error: Error;
* nodes: Array<Promise<import('types/internal').CSRComponent>>;
* url: URL;
* params: Record<string, string>;
* };
* }} opts
Expand Down
1 change: 0 additions & 1 deletion packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export async function render_response({
.map(({ node }) => `import(${s(options.prefix + node.entry)})`)
.join(',\n\t\t\t\t\t\t')}
],
url: new URL(${s(url.href)}),
params: ${devalue(params)}
}` : 'null'}
});
Expand Down