Socket
Socket
Sign inDemoInstall

solid-devtools

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-devtools

Runtime helpers for hooking up SolidJS application with Solid Devtools


Version published
Weekly downloads
9.6K
decreased by-19.68%
Maintainers
1
Weekly downloads
 
Created
Source

Solid Devtools Debugger

solid-devtools

A runtime package, used to get information and track changes of the Solid's reactivity graph. It's a cornerstone of the rest of the packages.

It comes with Extension Adapter and Locator packages included.

Usage Guide

Installation

npm i solid-devtools
# or
yarn add solid-devtools
# or
pnpm i solid-devtools

Attaching Debugger to your application

Currently you have to manually attach the debugger to the reactive graph of your application logic. You can do that with one of the two primitives:

attachDebugger

This is a hook that will attach the debugger to the reactive owner of the scope it was used under. For example you might want to use it in you <App> component, or directly in the render function. It can be used in many places at once without any issues.

import { render } from "solid-js/web"
import { attachDebugger } from "solid-devtools"

render(() => {
  attachDebugger()
  return <App />
}, document.getElementById("root")!)

// or inside the App component:
function App() {
  attachDebugger()
  return <>...</>
}
Debugger

The debugger component works exactly like attachDebugger, but it may be more convenient to use at times.

import { render } from "solid-js/web"
import { Debugger } from "solid-devtools"

render(
  () => (
    <Debugger>
      <App />
    </Debugger>
  ),
  document.getElementById("root")!,
)

Reattaching sub roots back to the tree

Solid doesn't attach roots created with createRoot to it's detached parent, so the debugger has no way of reaching it. To reattach this root back to the tree tracked by the debugger — simply put another attachDebugger call inside it.

More in this issue

This also will be necessary when using components that use createRoot internally, like <For>, <Index> or <Suspense>.

<For each={list()}>
	{item => (
		<Debugger>
			<ItemComponent title={item} />
		</Debugger>
	)}
<For>

// or call attachDebugger inside ItemComponent
function ItemComponent(props){
	attachDebugger()
	return <li>props.title</li>
}

Changelog

See CHANGELOG.md.

Keywords

FAQs

Package last updated on 23 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc