Describe the bug
In Solid 2.0.0-beta.14, creating a store from a null-prototype object can crash when reading a function-valued property.
Null-prototype objects are commonly used as dictionary objects because they avoid inherited keys like constructor and __proto__. A store proxy should be able to wrap and read them.
Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-fv9dqmqx?file=src%2FApp.tsx
import { createSignal, createStore } from 'solid-js';
const dictionary: any = Object.create(null);
dictionary.getValue = () => 42;
export default function App() {
const [store] = createStore(dictionary);
const [result, setResult] = createSignal('not run');
return (
<main>
<button
onClick={() => {
try {
setResult(`value: ${store.getValue()}`);
} catch (error) {
setResult(String(error));
}
}}
>
call function property
</button>
<p>{result()}</p>
</main>
);
}
Steps to Reproduce the Bug or Issue
- Open the repro.
- Click
call function property.
- Observe the rendered result.
Expected behavior
The function-valued property should be read and callable:
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: current stable
Additional context
This appears related to packages/solid-signals/src/store/store.ts, where a function-valued property read calls .hasOwnProperty directly on the wrapped source object. Null-prototype objects do not inherit hasOwnProperty, so the check should use a safe form such as Object.prototype.hasOwnProperty.call(...).
Describe the bug
In Solid 2.0.0-beta.14, creating a store from a null-prototype object can crash when reading a function-valued property.
Null-prototype objects are commonly used as dictionary objects because they avoid inherited keys like
constructorand__proto__. A store proxy should be able to wrap and read them.Your Example Website or App
https://stackblitz.com/edit/solidjs-templates-fv9dqmqx?file=src%2FApp.tsx
Steps to Reproduce the Bug or Issue
call function property.Expected behavior
The function-valued property should be read and callable:
Screenshots or Videos
No response
Platform
Additional context
This appears related to
packages/solid-signals/src/store/store.ts, where a function-valued property read calls.hasOwnPropertydirectly on the wrapped source object. Null-prototype objects do not inherithasOwnProperty, so the check should use a safe form such asObject.prototype.hasOwnProperty.call(...).