Skip to content

Commit

Permalink
dev: Add internal flag to signal
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Jan 2, 2025
1 parent 4d824b0 commit a4fa8a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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 @@ -233,8 +235,12 @@ export function createSignal<T>(

if ("_SOLID_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 a4fa8a3

Please sign in to comment.