Skip to content

Commit 95e843e

Browse files
authored
Workaround hydration scrolling bug (#4221)
* use src version locally * workaround #4216 * reimplement banner
1 parent cdc32a9 commit 95e843e

File tree

3 files changed

+46
-22
lines changed

3 files changed

+46
-22
lines changed

sites/kit.svelte.dev/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"name": "kit.svelte.dev",
33
"version": "0.0.1",
44
"scripts": {
5-
"dev": "svelte-kit dev",
6-
"build": "svelte-kit build --verbose",
5+
"dev": "node ./svelte-kit.js dev",
6+
"build": "node ./svelte-kit.js build --verbose",
77
"prebuild": "test \"$CI\" = true && npx pnpm install --store=node_modules/.pnpm-store || echo skipping pnpm install",
8-
"preview": "svelte-kit preview"
8+
"preview": "node ./svelte-kit.js preview"
99
},
1010
"devDependencies": {
1111
"@sveltejs/adapter-auto": "workspace:*",

sites/kit.svelte.dev/src/routes/__layout.svelte

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import { Icon, Icons, Nav, NavItem, PreloadingIndicator, SkipLink } from '@sveltejs/site-kit';
66
import Search from '$lib/search/Search.svelte';
77
import SearchBox from '$lib/search/SearchBox.svelte';
8-
9-
let h = 0;
10-
let w = 0;
11-
$: browser && document.documentElement.style.setProperty('--ukr-footer-height', `${h}px`);
128
</script>
139

1410
<Icons />
@@ -47,26 +43,26 @@
4743
</NavItem>
4844
</svelte:fragment>
4945
</Nav>
50-
<a target="_blank" rel="noopener noreferrer" href="https://www.stopputin.net/"
51-
><div class="ukr" bind:clientHeight={h} bind:clientWidth={w}>
52-
{#if w < 830}
53-
<strong>We stand with Ukraine.</strong>
54-
Donate →
55-
{:else}
56-
<strong>We stand with Ukraine.</strong>
57-
Petition your leaders. Show your support.
58-
{/if}
59-
</div></a
60-
>
61-
62-
<main id="main" style="padding-bottom: {h}px;">
46+
47+
<main id="main">
6348
<slot />
6449

6550
{#if browser}
6651
<SearchBox />
6752
{/if}
6853
</main>
6954

55+
<a target="_blank" rel="noopener noreferrer" href="https://www.stopputin.net/">
56+
<div class="ukr">
57+
<span class="small">
58+
<strong>We stand with Ukraine.</strong> Donate →
59+
</span>
60+
<span class="large">
61+
<strong>We stand with Ukraine.</strong> Petition your leaders. Show your support.
62+
</span>
63+
</div>
64+
</a>
65+
7066
<style>
7167
main {
7268
position: relative;
@@ -136,22 +132,36 @@
136132
font-size: 1.6rem !important;
137133
}
138134
135+
/** Ukraine banner */
136+
:root {
137+
--ukr-footer-height: 48px;
138+
}
139+
140+
main {
141+
padding-bottom: var(--ukr-footer-height);
142+
}
143+
139144
.ukr {
140145
background-color: #0066cc;
141146
color: white;
142147
position: fixed;
148+
display: flex;
149+
align-items: center;
150+
justify-content: center;
143151
bottom: 0;
144152
width: 100vw;
145-
text-align: center;
146-
padding: 0.75em;
153+
height: var(--ukr-footer-height);
147154
z-index: 999;
148155
}
156+
149157
:global(.examples-container, .repl-outer, .tutorial-outer) {
150158
height: calc(100vh - var(--nav-h) - var(--ukr-footer-height)) !important;
151159
}
160+
152161
:global(.toggle) {
153162
bottom: var(--ukr-footer-height) !important;
154163
}
164+
155165
@media (max-width: 830px) {
156166
:global(aside) {
157167
z-index: 9999 !important;

sites/kit.svelte.dev/svelte-kit.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { spawn } from 'child_process';
2+
import { fileURLToPath } from 'url';
3+
4+
const [node, , ...args] = process.argv;
5+
const mode = process.env.CI ? 'dist' : 'src';
6+
const bin = fileURLToPath(new URL(`../../packages/kit/${mode}/cli.js`, import.meta.url));
7+
8+
const child = spawn(node, [bin, ...args], {
9+
stdio: 'inherit'
10+
});
11+
12+
if (child) {
13+
child.on('exit', process.exit);
14+
}

0 commit comments

Comments
 (0)