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

Use value activate onmount #57

Merged
merged 2 commits into from
Jun 9, 2024
Merged

Use value activate onmount #57

merged 2 commits into from
Jun 9, 2024

Conversation

Bloomca
Copy link
Owner

@Bloomca Bloomca commented Jun 9, 2024

Description

Change how we add subscription to state changes when using useValue/useValueSelector. Before the subscription was activated immediately, but it created a problem that you could create a component, not mount it, and the value would still update the node inside (although only if it was not top-level).

It also would never unsubscribe, because there was no unmount event. This PR adds a subscription only when we actually mount the component, and update the value if it is different.

This is a part of #45, but it doesn't close it fully, because useValueIterator and trackValue have the same issue, I'll address them separately (the PR is already quite big).

@Bloomca Bloomca merged commit e080257 into main Jun 9, 2024
1 check passed
@Bloomca Bloomca deleted the use-value-activate-onmount branch June 9, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant