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

feat(apollo): subscription with initial data #3234

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

TrisNol
Copy link

@TrisNol TrisNol commented Jul 2, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Subscriptions created by utilizing the @nestjs/graphql related libs only serve updates triggered by the PubSub.asyncIterator while in some circumstances a subscription may serve initial data to avoid a Query + Subscription scenario resulting in complicated merges within the clients' business logic.

Issue Number: N/A

What is the new behavior?

A utils function has been added which can be used to combine an AsyncIterator with an array of existing data returning an AsyncIterableIterator which does satisfy the AsyncIterator interface - meaning that existing code / frameworks will not be broken if employed - while serving the list of initial entries first, followed by all real-time updates triggered via the PubSub iterator.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

The apollo package may not be the right place to store such utils, feedback would be highly appreciated!
Furthermore, an update to linting related dependencies had to be made in order to run the husky pre-commit locally.

@TrisNol TrisNol changed the title Feat/subscription with initial data feat(apollo): subscription with initial data Jul 2, 2024
@TrisNol TrisNol marked this pull request as ready for review July 7, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant