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

useObserver should trigger a rerender only if the observed value changed #101

Open
guyca opened this issue Jun 25, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working discussion

Comments

@guyca
Copy link
Collaborator

guyca commented Jun 25, 2023

Background

We should probably add another means to subscribe to Observables. Perhaps add a new subscribeUnique() method and use it from the useObserver hook.

API

useObserver<T>(observable: Observable, options?: {
  comparator: (a: T, b: T) => boolean
});

The default comparator will only perform a shallow comparison and users will be able to provider their own implementations.

@guyca guyca added the bug Something isn't working label Jun 25, 2023
@guyca guyca self-assigned this Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discussion
Projects
None yet
Development

No branches or pull requests

1 participant