fix(gloo-net): remove bug-abling EventSource Clone implementation #417
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.
PR Content
Remove the
Clonederive/impl for theEventSource.Reasoning
After discussing #409, it seems that the implementation of Clone for
EventSourceis a bug.To summarize the situation:
EventSourceimplementsDropand will disconnect the internal connection upon triggering this mechanism.However, when cloning this structure, if any instance of
EventSourceis going out of scope, all of the instances will have their internal connection disconnected.An example of a situation where this can be unexpected to the user and not straight forward:
yewduxto manage a mutable global state.yewdux's state will need to have the structs field that implClone. Hence here usingEventSourcein its previous version, would be allowed, without any additional wrapper. However, internallyyewduxclone's and drops the state, hence destroying the precious connection and rendering theEventSourcevirtually unusable, but without any explanation to the user.