Skip to content

Commit 89e016d

Browse files
thetarnavryansolid
andauthored
dev: Add internal flag to signal (#2393)
* dev: Add `internal` flag to signal * Create eighty-parents-scream.md --------- Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
1 parent 3579ec0 commit 89e016d

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

Diff for: .changeset/eighty-parents-scream.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"solid-js": patch
3+
---
4+
5+
dev: Add `internal` flag to signal

Diff for: packages/solid/src/reactive/signal.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export interface SignalState<T> extends SourceMapValue {
8585
observerSlots: number[] | null;
8686
tValue?: T;
8787
comparator?: (prev: T, next: T) => boolean;
88+
// development-only
89+
internal?: true;
8890
}
8991

9092
export interface Owner {
@@ -236,8 +238,12 @@ export function createSignal<T>(
236238

237239
if (IS_DEV) {
238240
if (options.name) s.name = options.name;
239-
if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s);
240-
if (!options.internal) registerGraph(s);
241+
if (options.internal) {
242+
s.internal = true;
243+
} else {
244+
registerGraph(s);
245+
if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s);
246+
}
241247
}
242248

243249
const setter: Setter<T | undefined> = (value?: unknown) => {

0 commit comments

Comments
 (0)