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

fix #2282: Add Check for Proxy support #2284

Merged
merged 2 commits 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
5 changes: 5 additions & 0 deletions .changeset/quick-mirrors-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

fix #2282: Add Check for Proxy support
1 change: 1 addition & 0 deletions packages/solid/src/reactive/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type { FlowComponent, FlowProps } from "../render/index.js";

export const equalFn = <T>(a: T, b: T) => a === b;
export const $PROXY = Symbol("solid-proxy");
export const SUPPORTS_PROXY = typeof Proxy === "function";
export const $TRACK = Symbol("solid-track");
export const $DEVCOMP = Symbol("solid-dev-component");
const signalOptions = { equals: equalFn };
Expand Down
5 changes: 3 additions & 2 deletions packages/solid/src/render/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
createMemo,
devComponent,
$PROXY,
SUPPORTS_PROXY,
$DEVCOMP,
EffectFunction
} from "../reactive/signal.js";
Expand Down Expand Up @@ -197,7 +198,7 @@ export function mergeProps<T extends unknown[]>(...sources: T): MergeProps<T> {
sources[i] =
typeof s === "function" ? ((proxy = true), createMemo(s as EffectFunction<unknown>)) : s;
}
if (proxy) {
if (SUPPORTS_PROXY && proxy) {
return new Proxy(
{
get(property: string | number | symbol) {
Expand Down Expand Up @@ -280,7 +281,7 @@ export function splitProps<
T extends Record<any, any>,
K extends [readonly (keyof T)[], ...(readonly (keyof T)[])[]]
>(props: T, ...keys: K): SplitProps<T, K> {
if ($PROXY in props) {
if (SUPPORTS_PROXY && $PROXY in props) {
const blocked = new Set<keyof T>(keys.length > 1 ? keys.flat() : keys[0]);
const res = keys.map(k => {
return new Proxy(
Expand Down
Loading