absinthe-graphql / absinthe

The GraphQL toolkit for Elixir
http://absinthe-graphql.org
Other
4.29k stars 527 forks source link

With duplicate subscriptions unsubscribing of one of the subs kills both records in Registry #1335

Closed youroff closed 3 months ago

youroff commented 3 months ago

Environment

Expected behavior

We want to subscribe to the same subscription twice: one subscription is alive throughout the lifecycle of the app (counter for notifications), second is only alive when a component rendering the content of notifications is open.

Actual behavior

When subscribing to the same subscription twice (with different set of fields), unsubscribing of one of the subs kills the second sub. It happens due to unregistering by field_key, which is a total duplicate in this case: https://github.com/absinthe-graphql/absinthe/blob/5705d9a0e16bf425d29f5fc7a945bbff4d751ec5/lib/absinthe/subscription.ex#L179 I believe it should check the record and only remove references to doc_ids.