Skip to content

Commit

Permalink
fix #2282: Add Check for Proxy support (#2284)
Browse files Browse the repository at this point in the history
* fix: Add Check for Proxy support

* Create quick-mirrors-mix.md

---------

Co-authored-by: Ryan Carniato <ryansolid@gmail.com>
  • Loading branch information
chiefcll and ryansolid committed Sep 23, 2024
1 parent 73c0092 commit 9e192d7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
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

0 comments on commit 9e192d7

Please sign in to comment.