Skip to content

Commit 26cf5e0

Browse files
committed
fix(desktop): perf stuff
1 parent 742cf10 commit 26cf5e0

5 files changed

Lines changed: 12 additions & 14 deletions

File tree

‎packages/ui/src/components/basic-tool.tsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { children, For, Match, Show, Switch, type JSX } from "solid-js"
1+
import { For, Match, Show, Switch, type JSX } from "solid-js"
22
import { Collapsible } from "./collapsible"
33
import { Icon, IconProps } from "./icon"
44

@@ -27,7 +27,6 @@ export interface BasicToolProps {
2727
}
2828

2929
export function BasicTool(props: BasicToolProps) {
30-
const resolved = children(() => props.children)
3130
return (
3231
<Collapsible defaultOpen={props.defaultOpen}>
3332
<Collapsible.Trigger>
@@ -81,13 +80,13 @@ export function BasicTool(props: BasicToolProps) {
8180
</Switch>
8281
</div>
8382
</div>
84-
<Show when={resolved() && !props.hideDetails}>
83+
<Show when={props.children && !props.hideDetails}>
8584
<Collapsible.Arrow />
8685
</Show>
8786
</div>
8887
</Collapsible.Trigger>
89-
<Show when={resolved() && !props.hideDetails}>
90-
<Collapsible.Content>{resolved()}</Collapsible.Content>
88+
<Show when={props.children && !props.hideDetails}>
89+
<Collapsible.Content>{props.children}</Collapsible.Content>
9190
</Show>
9291
</Collapsible>
9392
)

‎packages/ui/src/components/checkbox.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Checkbox as Kobalte } from "@kobalte/core/checkbox"
2-
import { children, Show, splitProps } from "solid-js"
2+
import { Show, splitProps } from "solid-js"
33
import type { ComponentProps, JSX, ParentProps } from "solid-js"
44

55
export interface CheckboxProps extends ParentProps<ComponentProps<typeof Kobalte>> {
@@ -10,7 +10,6 @@ export interface CheckboxProps extends ParentProps<ComponentProps<typeof Kobalte
1010

1111
export function Checkbox(props: CheckboxProps) {
1212
const [local, others] = splitProps(props, ["children", "class", "label", "hideLabel", "description", "icon"])
13-
const resolved = children(() => local.children)
1413
return (
1514
<Kobalte {...others} data-component="checkbox">
1615
<Kobalte.Input data-slot="checkbox-checkbox-input" />
@@ -29,9 +28,9 @@ export function Checkbox(props: CheckboxProps) {
2928
</Kobalte.Indicator>
3029
</Kobalte.Control>
3130
<div data-slot="checkbox-checkbox-content">
32-
<Show when={resolved()}>
31+
<Show when={props.children}>
3332
<Kobalte.Label data-slot="checkbox-checkbox-label" classList={{ "sr-only": local.hideLabel }}>
34-
{resolved()}
33+
{props.children}
3534
</Kobalte.Label>
3635
</Show>
3736
<Show when={local.description}>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[data-component="code"] {
2+
content-visibility: auto;
23
overflow: hidden;
34
}

‎packages/ui/src/components/diff.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[data-component="diff"] {
2-
contain: content;
2+
content-visibility: auto;
33

44
[data-slot="diff-hunk-separator-line-number"] {
55
position: sticky;

‎packages/ui/src/components/switch.tsx‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Switch as Kobalte } from "@kobalte/core/switch"
2-
import { children, Show, splitProps } from "solid-js"
2+
import { Show, splitProps } from "solid-js"
33
import type { ComponentProps, ParentProps } from "solid-js"
44

55
export interface SwitchProps extends ParentProps<ComponentProps<typeof Kobalte>> {
@@ -9,13 +9,12 @@ export interface SwitchProps extends ParentProps<ComponentProps<typeof Kobalte>>
99

1010
export function Switch(props: SwitchProps) {
1111
const [local, others] = splitProps(props, ["children", "class", "hideLabel", "description"])
12-
const resolved = children(() => local.children)
1312
return (
1413
<Kobalte {...others} data-component="switch">
1514
<Kobalte.Input data-slot="switch-input" />
16-
<Show when={resolved()}>
15+
<Show when={local.children}>
1716
<Kobalte.Label data-slot="switch-label" classList={{ "sr-only": local.hideLabel }}>
18-
{resolved()}
17+
{local.children}
1918
</Kobalte.Label>
2019
</Show>
2120
<Show when={local.description}>

0 commit comments

Comments
 (0)