Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf(observableset): Remove extra clone operation on .values .keys .Iterator access #3993

Merged
merged 6 commits into from
Jan 30, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Omit redundant keys variable
tonyraoul committed Jan 19, 2025
commit 3b97c6ec3c67ffdc80ec244748afc154d23af1f9
8 changes: 2 additions & 6 deletions packages/mobx/src/types/observableset.ts
Original file line number Diff line number Diff line change
@@ -211,15 +211,11 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
}

entries() {
const keys = this.keys()
const values = this.values()
return makeIterableForSet<[T, T]>({
next() {
const key = keys.next()
const value = values.next()
return !key.done && !value.done
? { value: [key.value, value.value], done: false }
: { value: undefined, done: true }
const { value, done } = values.next()
return !done ? { value: [value, value], done } : { value: undefined, done }
}
})
}