Skip to content

Commit

Permalink
debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Feb 9, 2023
1 parent 94af288 commit ec618f5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/kit/src/runtime/client/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,30 @@ export async function start({ app, assets, hydrate, target, version }) {
);
}

const client = create_client({ app: await app, target });
let resolved;
console.log('awaiting app');
try {
resolved = await app;
} catch (e) {
console.error('something went wrong while awaiting app');
console.error(e);
throw e;
}
console.log('awaited app, create client');
const client = create_client({ app: resolved, target });

console.log('init client');
init({ client });

console.log('hydrating');
if (hydrate) {
await client._hydrate(hydrate);
} else {
client.goto(location.href, { replaceState: true });
}

client._start_router();
console.log('finished');
}

export { set_public_env as env };
2 changes: 2 additions & 0 deletions packages/kit/src/runtime/server/page/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,10 @@ export async function render_response({
const init_app = `
import { env, start } from ${s(prefixed(client.start.file))};
console.log('setting env');
env(${s(public_env)});
console.log('starting app');
start({
${opts.join(',\n\t\t\t\t')}
});
Expand Down
2 changes: 2 additions & 0 deletions packages/kit/test/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import { onMount } from 'svelte';

export function setup() {
console.log('calling setup()');
onMount(() => {
// give tests programmatic control over the app
Object.assign(window, {
Expand All @@ -22,5 +23,6 @@ export function setup() {

// communicate that the app is ready
document.body.classList.add('started');
console.log('added classlist to body');
});
}

0 comments on commit ec618f5

Please sign in to comment.