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

svelte: subscriptions can not be terminated #948

Closed
cfbraun opened this issue Aug 31, 2020 · 1 comment
Closed

svelte: subscriptions can not be terminated #948

cfbraun opened this issue Aug 31, 2020 · 1 comment
Labels
bug 🐛 Oh no! A bug or unintented behaviour.

Comments

@cfbraun
Copy link

cfbraun commented Aug 31, 2020

urql version & exchanges: svelte 0.4.0

Steps to reproduce

<script>
  import { subscription } from '@urql/svelte'

  $: foo = subscription({
    query: `subscription{liveStatus{pendingApprovals, pendingRequests}}`,
  })
  $: console.log('foo', $foo)
</script>
<div>{$foo}</div>
  • Enter and leave component a few times, then enter again
  • Trigger one update to the subscription

Expected behavior

'foo' should be logged only once

Actual behavior

Every time the component is entered another subscription is created. When triggering a single update 'foo' will be logged N times.

Suspected cause

query.ts and subscription.ts create pipes using the Wonka share operator and then call publish once to start the stream. publish is registered as a sink on the share operator that is never removed and the stream is never closed.

Removing the publish call will only start the stream when it is actually subscribed, which seems to make sense and works as advertised.

@cfbraun cfbraun added the bug 🐛 Oh no! A bug or unintented behaviour. label Aug 31, 2020
@kitten
Copy link
Member

kitten commented Sep 28, 2020

Our current bindings for Svelte have a lot of problems, as we never intended for them to be extensively used already. Hence I'm grouping several issues into an umbrella issue to express an intent to reimplement the bindings for a v1.0 with all that we've learned, which supersedes this issue.
The umbrella issue where we'll plan out a new version, API, and implementation can be found here: #1007

@kitten kitten closed this as completed Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Oh no! A bug or unintented behaviour.
Projects
None yet
Development

No branches or pull requests

2 participants