Skip to content

Commit 9bad4dd

Browse files
committed
Sort signals (memos last)
1 parent d179192 commit 9bad4dd

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.changeset/heavy-papayas-search.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"solid-devtools-extension": patch
3+
"@solid-devtools/ui": patch
4+
---
5+
6+
Sort signals (memos last)

packages/extension/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
import { highlights, graphs } from "./state/graph"
1414
import { focused, details, useUpdatedSignalsSelector } from "./state/details"
1515
import * as styles from "./styles.css"
16-
import { Transition } from "solid-transition-group"
1716

1817
const DetailsContent: Component<{ details: OwnerDetails }> = props => {
1918
const { name, id, type, path, signals } = destructure(() => props.details)

packages/ui/src/signal/SignalNode.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Component, createEffect, createMemo, For, Match, Show, Switch } from "solid-js"
2-
import { GraphSignal } from "@solid-devtools/shared/graph"
1+
import { Component, createEffect, createMemo, For, Show } from "solid-js"
2+
import { GraphSignal, NodeType } from "@solid-devtools/shared/graph"
33
import { useHighlights, useSignalContext } from "../ctx/highlights"
44
import { createHover } from "@solid-aria/interactions"
55
import {
@@ -120,10 +120,16 @@ const ValuePreview: Component<{
120120
}
121121

122122
export const Signals: Component<{ each: GraphSignal[] }> = props => {
123+
const sorted = createMemo(() =>
124+
props.each.slice().sort((a, b) => {
125+
if (a.type === b.type) return a.id > b.id ? 1 : -1
126+
return a.type === NodeType.Memo ? 1 : -1
127+
}),
128+
)
123129
return (
124130
<Show when={props.each.length}>
125131
<div class={styles.Signals.container}>
126-
<For each={props.each}>{signal => <SignalNode signal={signal} />}</For>
132+
<For each={sorted()}>{signal => <SignalNode signal={signal} />}</For>
127133
</div>
128134
</Show>
129135
)

0 commit comments

Comments
 (0)