Skip to content

Commit 40d67ef

Browse files
committed
whoops
1 parent 8c4c8d8 commit 40d67ef

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/routes/(info)/lttstore/totals/TotalMoveRateGraph.svelte

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import uPlot from "uplot";
99
import 'uplot/dist/uPlot.min.css';
1010
import { stockGaps, timeFormat, stockColors } from '$lib/lttstore/product/ProductStockHistoryGraph.svelte';
11+
import { browser } from "$app/environment";
1112
1213
let {
1314
stockHistory,
@@ -74,15 +75,17 @@
7475
let width = $derived(wrapperDiv?.clientWidth ?? 1490);
7576
let height = $derived(width / 2);
7677
77-
const resizeObserver = new ResizeObserver(() => {
78-
const newWidth = wrapperDiv?.clientWidth ?? 1490;
79-
setTimeout(() => {
80-
if(newWidth === (wrapperDiv?.clientWidth ?? 1490)) {
81-
width = newWidth;
82-
}
83-
}, 100);
84-
});
85-
$effect(() => wrapperDiv && resizeObserver.observe(wrapperDiv));
78+
if(browser) {
79+
const resizeObserver = new ResizeObserver(() => {
80+
const newWidth = wrapperDiv?.clientWidth ?? 1490;
81+
setTimeout(() => {
82+
if(newWidth === (wrapperDiv?.clientWidth ?? 1490)) {
83+
width = newWidth;
84+
}
85+
}, 100);
86+
});
87+
$effect(() => wrapperDiv && resizeObserver.observe(wrapperDiv));
88+
}
8689
8790
const options: uPlot.Options = $derived({
8891
title: 'Move Rate History - All Products',

0 commit comments

Comments
 (0)