Skip to content

Commit

Permalink
Fix channel leave on unjoined channels. Closes #5779
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismccord committed Apr 11, 2024
1 parent 28203dd commit 72c388c
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -48,6 +48,9 @@ future styling).

## 1.7.12

### JavaScript Client Bug Fixes
* Fix all unjoined channels from being removed from the socket when channel leave is called on any single unjoined channel instance

### Enhancements
* [phx.gen.auth] Add enhanced session fixation protection.
For applications whichs previously used `phx.gen.auth`, the following line can be added to the `renew_session` function in the auth module:
Expand Down
2 changes: 1 addition & 1 deletion assets/js/phoenix/socket.js
Expand Up @@ -543,7 +543,7 @@ export default class Socket {
*/
remove(channel){
this.off(channel.stateChangeRefs)
this.channels = this.channels.filter(c => c.joinRef() !== channel.joinRef())
this.channels = this.channels.filter(c => c !== channel)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion priv/static/phoenix.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions priv/static/phoenix.cjs.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion priv/static/phoenix.js
Expand Up @@ -1461,7 +1461,7 @@ var Phoenix = (() => {
*/
remove(channel) {
this.off(channel.stateChangeRefs);
this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
this.channels = this.channels.filter((c) => c !== channel);
}
/**
* Removes `onOpen`, `onClose`, `onError,` and `onMessage` registrations.
Expand Down
4 changes: 2 additions & 2 deletions priv/static/phoenix.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion priv/static/phoenix.mjs
Expand Up @@ -1432,7 +1432,7 @@ var Socket = class {
*/
remove(channel) {
this.off(channel.stateChangeRefs);
this.channels = this.channels.filter((c) => c.joinRef() !== channel.joinRef());
this.channels = this.channels.filter((c) => c !== channel);
}
/**
* Removes `onOpen`, `onClose`, `onError,` and `onMessage` registrations.
Expand Down
4 changes: 2 additions & 2 deletions priv/static/phoenix.mjs.map

Large diffs are not rendered by default.

0 comments on commit 72c388c

Please sign in to comment.