docs&refactor(useWebSocket/useEventSource)!: uniformize immediate
behaviour
#4204
+6
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
fixes #123
).Description
As I was pointed here, there's a mismatch between the behaviour of the
immediate
setting in bothuseWebSocket
anduseEventSource
: in all the others composables, theimmediate
flag just specifies that the composable should "act" as soon as it's invoked, but inuseWebSocket
anduseEventSource
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.