Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: don't wrap a wrapped signal #6904

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/qwik/src/core/state/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ export const _wrapProp = <T extends Record<any, any>, P extends keyof T>(
}
if (isSignal(obj)) {
assertEqual(prop, 'value', 'Left side is a signal, prop must be value');
if (obj instanceof WrappedSignal) {
return obj;
}
return new WrappedSignal(null, getProp, [obj, prop as string], null);
}
if (_CONST_PROPS in obj) {
Expand Down
1 change: 0 additions & 1 deletion packages/qwik/src/core/v2/signal/v2-signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ export class ComputedSignal<T> extends Signal<T> {
}
}

// TO DISCUSS: shouldn't this type of signal have the $dependencies$ array instead of EVERY type of signal?
export class WrappedSignal<T> extends Signal<T> implements Subscriber {
$args$: any[];
$func$: (...args: any[]) => T;
Expand Down