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

Unable to disconnect after reconnecting #43

Closed
oscarhermoso opened this issue May 10, 2024 · 2 comments
Closed

Unable to disconnect after reconnecting #43

oscarhermoso opened this issue May 10, 2024 · 2 comments
Labels
seen I've seen and read this issue and I'll try find some time soon to work on it.

Comments

@oscarhermoso
Copy link
Contributor

oscarhermoso commented May 10, 2024

Reproduce

Code that reproduces the issue looks something like this:

  // +page.ts
  export function load() {
    let reconnect
    const connection = source(`/room/waiting-lobby`, {
      close({ connect }) { connect = reconnect } })
    })
    const events = connection.select('events').json()
    return { events, connection, reconnect }
  }
<!-- +page.svelte -->
<script>
  export let data
</script>

{data.events}

<button on:click={data.connection.close}>Disconnect</button>
<button on:click={data.reconnect}>Reconnect</button>
  1. Load page
  2. Click disconnect
  3. Click reconnect
  4. Click disconnect

Full code repro also raised as this PR, #44

Expected

Page loads, disconnects, reconnects, and then disconnects again

Actual

Page loads, disconnects, reconnects, and then is no longer able to disconnect by calling data.connection.close()

@razshare razshare added the seen I've seen and read this issue and I'll try find some time soon to work on it. label May 10, 2024
razshare added a commit that referenced this issue May 10, 2024
…he internal abort controller when calling connect() for a second time.

This caused the `close()` function to not work properly.
See #43
razshare added a commit that referenced this issue May 10, 2024
…he internal abort controller when calling connect() for a second time.

This caused the `close()` function to not work properly.
See #43
@razshare
Copy link
Owner

razshare commented May 10, 2024

Hello @oscarhermoso ,

This should now be fixed, please update to version 0.12.10 to get the changes.

I've tried your reproduction and it seems to work as intended (can you confirm it's the intended behavior?)

Peek 2024-05-11 01-42

Let me know if this addresses your issue.

@oscarhermoso
Copy link
Contributor Author

Works great! Thanks again @tncrazvan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
seen I've seen and read this issue and I'll try find some time soon to work on it.
Projects
None yet
Development

No branches or pull requests

2 participants