Skip to content

Commit c0364b1

Browse files
committed
refactor: move ref to root container
1 parent 1b767ac commit c0364b1

3 files changed

Lines changed: 8 additions & 15 deletions

File tree

bun.lock

Lines changed: 3 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/solid-uplot/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,6 @@
9595
"test:cov": "vitest run --coverage",
9696
"typecheck": "tsc --noEmit"
9797
},
98-
"dependencies": {
99-
"@solid-primitives/refs": "^1.1.2"
100-
},
10198
"peerDependencies": {
10299
"solid-js": ">=1.6.0",
103100
"uplot": ">=1.6.32"

packages/solid-uplot/src/SolidUplot.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import "uplot/dist/uPlot.min.css";
22

3-
import { mergeRefs, Ref } from "@solid-primitives/refs";
43
import {
54
createEffect,
65
createMemo,
@@ -9,6 +8,7 @@ import {
98
mergeProps,
109
onCleanup,
1110
type ParentProps,
11+
type Ref,
1212
splitProps,
1313
untrack,
1414
} from "solid-js";
@@ -281,8 +281,8 @@ export const SolidUplot = <T extends VoidStruct = VoidStruct>(
281281
hasWarnedZeroHeight = true;
282282
console.warn(
283283
"[SolidUplot] autoResize observed 0px height. " +
284-
"Ensure the parent container has an explicit height " +
285-
"or is within a flex/grid layout that provides height.",
284+
"Ensure the parent container has an explicit height " +
285+
"or is within a flex/grid layout that provides height.",
286286
);
287287
}
288288

@@ -311,6 +311,7 @@ export const SolidUplot = <T extends VoidStruct = VoidStruct>(
311311
return (
312312
<div
313313
id="solid-uplot-root"
314+
ref={local.ref}
314315
class={classes()}
315316
style={{
316317
display: "flex",
@@ -326,7 +327,7 @@ export const SolidUplot = <T extends VoidStruct = VoidStruct>(
326327
>
327328
{local.children}
328329
<div
329-
ref={mergeRefs(local.ref, (el) => (container = el))}
330+
ref={container}
330331
class="solid-uplot-chart"
331332
style={{
332333
position: "relative",

0 commit comments

Comments
 (0)