Skip to content

2.0.0-beta.14: Object.keys(store) throws for stores with non-configurable own properties #2770

Description

@yumemi-thomas

Describe the bug

In Solid 2.0.0-beta.14, creating a store from an object with a non-configurable enumerable own property can make Object.keys(store) throw a proxy invariant error.

The source object can be read normally, but enumerating keys through the store proxy fails.

Your Example Website or App

https://stackblitz.com/edit/solidjs-templates-x741dmhw?file=src%2FApp.tsx

Minimal repro app:

import { createSignal, createStore } from "solid-js";

const source: any = {};

Object.defineProperty(source, "id", {
  value: 1,
  enumerable: true,
  writable: true,
  configurable: false
});

export default function App() {
  const [store] = createStore(source);
  const [result, setResult] = createSignal("not run");

  return (
    <main>
      <button
        onClick={() => {
          try {
            setResult(`keys: ${Object.keys(store).join(",")} id: ${store.id}`);
          } catch (error) {
            setResult(String(error));
          }
        }}
      >
        read keys
      </button>

      <p>{result()}</p>
    </main>
  );
}

Steps to Reproduce the Bug or Issue

  1. Open the repro.
  2. Click read keys.
  3. Observe the rendered result.

Expected behavior

The store should enumerate the source object's enumerable own property:

keys: id id: 1

### Screenshots or Videos

_No response_

### Platform

- OS: macOS
- Browser: Chrome
- Version: current stable

### Additional context

Actual behavior in the buggy version is a proxy invariant error similar to:

```text
TypeError: 'getOwnPropertyDescriptor' on proxy: trap reported non-configurability for property 'id' ...

This appears related to packages/solid-signals/src/store/store.ts in the store proxy getOwnPropertyDescriptor trap. The trap forwards the source descriptor for non-configurable properties, but the proxy target is the internal store node rather than the original source object, which can violate JavaScript proxy invariants during key enumeration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions