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

docs&refactor(useWebSocket/useEventSource)!: uniformize immediate behaviour #4204

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ferferga
Copy link
Contributor

@ferferga ferferga commented Sep 5, 2024

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Description

As I was pointed here, there's a mismatch between the behaviour of the immediate setting in both useWebSocket and useEventSource: in all the others composables, the immediate flag just specifies that the composable should "act" as soon as it's invoked, but in useWebSocket and useEventSource it also opts-out all the reactivity from the refs.

In my opinion, opting out from the reactivity doesn't make sense, since that's essentially the goal of VueUse (provide reactive wrappers around common browser APIs).

I believe the intended behaviour is to work like all the other composables (1) (2) (that PR was correct according to docs, but incorrect for my "concept" of immediate).

Feel free to close this PR in case the current behaviour is correct.

Additional context

Not sure either if this should be considered a breaking change.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Sep 5, 2024
@ferferga ferferga changed the title docs&refactor(useWebSocket/useEventSource): uniformize immediate behaviour docs&refactor(useWebSocket/useEventSource)!: uniformize immediate behaviour Sep 5, 2024
@dosubot dosubot bot added the documentation Improvements or additions to documentation label Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant