-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
IMPORTANT: If you have a question or an idea for a new feature use Github Discussions instead
Describe the bug
In the source code, such as Provider, the implementation of nested createMemo is used, but I found that nested createMemo should have some problems. For example, the following example
To Reproduce
Provide a code snippet and steps to reproduce the behavior:
- run this code
import { createState, createEffect, createMemo, createMutable } from 'solid-js'
import { render } from 'solid-js/web'
function App() {
const state = createMutable({
school: 'school',
home: 'home'
})
const getAll = createMemo(() => {
const home = createMemo(() => {
console.log('Memo: ', state.home)
return state.home
})
const school = createMemo(() => {
console.log('Memo: ', state.school)
return state.school
})
return home() + school()
})
const click = () => {
state.school = state.school + '.'
}
return (
<div onClick={click}>
{state.home + state.school}
<br/>
{getAll()}
</div>
)
}
render(() => <App />, document.getElementById('app'))Expected behavior
Only 'Memo: school' is triggered
The End
Does the source code need to cancel the writing of nested createMemo?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels