Deepobserve does not observe changes in set
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to use deepObserve() with an object that has an ObservableSet field but the changes in this field are not reported.
class Foo {
@observable barSet = new Set()
}
const foo = new Foo
deepObserve(foo, () => {
console.log('foo changed')
})
foo.barSet.add('bar') // "foo changed" is not logged to the console
Is this something that is supported? I looked into the deepObserve code and found that it uses this function:
function isRecursivelyObservable(thing: any) {
return isObservableObject(thing) || isObservableArray(thing) || isObservableMap(thing)
}
to determine whether an object can be observed but the isObservableSet check is missing.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating deepObserve and its isRecursivelyObservable helper, then inspect how observable objects, arrays, and maps are handled. Verify whether adding isObservableSet support makes changes to the ObservableSet trigger the callback, and add or update a regression test showing that foo.barSet.add('bar') is reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100