File tree Expand file tree Collapse file tree
src/routes/(info)/lttstore/totals Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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,
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' ,
You can’t perform that action at this time.
0 commit comments