Skip to content

Commit

Permalink
dev: Add internal flag to signal (#2393)
Browse files Browse the repository at this point in the history
* dev: Add `internal` flag to signal

* Create eighty-parents-scream.md

---------

Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
  • Loading branch information
thetarnav and ryansolid authored Feb 21, 2025
1 parent 3579ec0 commit 89e016d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-parents-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

dev: Add `internal` flag to signal
10 changes: 8 additions & 2 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export interface SignalState<T> extends SourceMapValue {
observerSlots: number[] | null;
tValue?: T;
comparator?: (prev: T, next: T) => boolean;
// development-only
internal?: true;
}

export interface Owner {
Expand Down Expand Up @@ -236,8 +238,12 @@ export function createSignal<T>(

if (IS_DEV) {
if (options.name) s.name = options.name;
if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s);
if (!options.internal) registerGraph(s);
if (options.internal) {
s.internal = true;
} else {
registerGraph(s);
if (DevHooks.afterCreateSignal) DevHooks.afterCreateSignal(s);
}
}

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

0 comments on commit 89e016d

Please sign in to comment.