Describe the bug
returning a store top level, in a projection createProjection(()=>store)
creates a projection that does not update, when the store is updated.
if the store is nested in the projection, the project will update when the store updates
createProjection(()=>[store])
createProjection(()=>{somekey:store})
import { render } from '@solidjs/web';
import { createProjection, createStore } from 'solid-js';
const [store, setStore] = createStore(() => {
return { a: 1, }
}, {} as { a: number })
let storeProjection = createProjection(
() => {
return store
}, {}
)
let storeProjection2 = createProjection(
() => {
return {nested:store}
}, {}
)
// update store in 1s
setTimeout(() => {
setStore(v => { v.a = 5555 })
}, 1000)
// observe that Projection is not updated.
export default function App() {
return (
<div class="p-2">
<div>
Store: {store.a} <hr />
Projection : {storeProjection.a} <b><---</b><hr />
Projection(nested) : {storeProjection2.nested.a} <hr />
</div>
</div>
);
}
if (typeof document !== 'undefined') {
render(() => <App />, document.getElementById('root')!);
}
expect rendered to be this after the store update.
Store: 5555
Projection : 5555
Projection(nested) : 5555
actual
Store: 5555
Projection : 1
Projection(nested) : 5555
Your Example Website or App
https://s.olid.uk/id/SBHb6sz0SdGCcoD738R8Cg
Steps to Reproduce the Bug or Issue
see reproduction code
Expected behavior
projected store should project the store it is returning.
Screenshots or Videos
Platform
.
Additional context
worked in beta.15
Describe the bug
returning a store top level, in a projection
createProjection(()=>store)creates a projection that does not update, when the
storeis updated.if the store is nested in the projection, the project will update when the store updates
expect rendered to be this after the store update.
actual
Your Example Website or App
https://s.olid.uk/id/SBHb6sz0SdGCcoD738R8Cg
Steps to Reproduce the Bug or Issue
see reproduction code
Expected behavior
projected store should project the store it is returning.
Screenshots or Videos
Platform
.
Additional context
worked in beta.15