Skip to content

Commit 965afc5

Browse files
authored
docs: correct variable references (#11582)
1 parent 61bf972 commit 965afc5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sites/svelte-5-preview/src/routes/docs/content/02-examples/04-old-vs-new.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,17 @@ With runes, we can use `$effect.pre`, which behaves the same as `$effect` but ru
148148
+ let theme = $state('dark');
149149
+ let messages = $state([]);
150150

151-
let div;
151+
let viewport;
152152

153153
- beforeUpdate(() => {
154154
+ $effect.pre(() => {
155155
- if (!updatingMessages) return;
156156
+ messages;
157-
const autoscroll = div && div.offsetHeight + div.scrollTop > div.scrollHeight - 50;
157+
const autoscroll = viewport && viewport.offsetHeight + viewport.scrollTop > viewport.scrollHeight - 50;
158158

159159
if (autoscroll) {
160160
tick().then(() => {
161-
div.scrollTo(0, div.scrollHeight);
161+
viewport.scrollTo(0, viewport.scrollHeight);
162162
});
163163
}
164164

0 commit comments

Comments
 (0)