Skip to content

Commit 19cc46c

Browse files
committed
refactor(devtools): switch highlight state init to function-based approach in source inspector
1 parent 6be26fb commit 19cc46c

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

packages/devtools/src/components/source-inspector.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ import { createMousePosition } from '@solid-primitives/mouse'
66
import { createEventListener } from '@solid-primitives/event-listener'
77

88
export const SourceInspector = () => {
9-
const highlightStateInit = {
9+
const highlightStateInit = () => ({
1010
element: null as HTMLElement | null,
1111
bounding: { width: 0, height: 0, left: 0, top: 0 },
1212
dataSource: '',
13-
}
14-
15-
const [highlightState, setHighlightState] = createStore({
16-
...highlightStateInit,
1713
})
14+
15+
const [highlightState, setHighlightState] = createStore(highlightStateInit())
1816
const resetHighlight = () => {
19-
setHighlightState({ ...highlightStateInit })
17+
setHighlightState(highlightStateInit())
2018
}
2119

2220
const [nameTagRef, setNameTagRef] = createSignal<HTMLDivElement | null>(null)

0 commit comments

Comments
 (0)