Conversation

yaacovCR

with respect to possible promises

motivations:

  1. no need to enter event loop unnecessarily
  2. further step toward integration of subscribe workflow into execute

@netlify

Deploy Preview for compassionate-pike-271cb3 ready!

NameLink
🔨 Latest commit6714bbe
🔍 Latest deploy loghttps://app.netlify.com/sites/compassionate-pike-271cb3/deploys/62a24882d5e85b000814bddd
😎 Deploy Previewhttps://deploy-preview-3620--compassionate-pike-271cb3.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@yaacovCRyaacovCR requested a review from a team May 31, 2022 12:22
@yaacovCRyaacovCR added the PR: breaking change 💥implementation requires increase of "major" version numberlabel May 31, 2022
@yaacovCRyaacovCR force-pushed the align branch 2 times, most recently from a735422 to b0e56f2 Compare June 7, 2022 07:45
yaacovCR added a commit to yaacovCR/graphql-js that referenced this pull request Jun 7, 2022
Two test groups use essentially the same logic to set up a subscription with an improper subscribeFn, testing both `subscribe` and `createSourceEventStream`.

This PR extracts the duplicated logic into a single common `subscribeWithBadFn` function.

For convenience, the common function is typed to appropriately return a `Promise<ExecutionResult>` rather than a `Promise<ExecutionResult | AsyncGenerator<...>>`). Because the `subscribeFn` is expected to be "bad," an `AsyncGenerator` should never be returned. If a valid `subscribeFn` is mistakenly passed, an assertion failure is triggered.

extracted from graphql#3620
@yaacovCRyaacovCR force-pushed the align branch 2 times, most recently from d89e2de to 7f214ea Compare June 7, 2022 10:17
@yaacovCR

because this depends on #3630 the diff to review (until #3630 is merged) would be here:

yaacovCR/graphql-js@extract...align

@yaacovCRyaacovCR force-pushed the align branch 2 times, most recently from 2321ee8 to 3b27fb6 Compare June 7, 2022 11:40
IvanGoncharov pushed a commit that referenced this pull request Jun 8, 2022
Two test groups use essentially the same logic to set up a subscription with an improper subscribeFn, testing both `subscribe` and `createSourceEventStream`.

This PR extracts the duplicated logic into a single common `subscribeWithBadFn` function.

For convenience, the common function is typed to appropriately return a `Promise<ExecutionResult>` rather than a `Promise<ExecutionResult | AsyncGenerator<...>>`). Because the `subscribeFn` is expected to be "bad," an `AsyncGenerator` should never be returned. If a valid `subscribeFn` is mistakenly passed, an assertion failure is triggered.

extracted from #3620
with respect to possible promises
@yaacovCR

@IvanGoncharov @graphql/graphql-js-reviewers

This has been rebased and is re-ready for review.

= remove unnecessary waits
= simply subscribeWithBadFn
until it is asserted as eventStream
@yaacovCRyaacovCR merged commit 6d42ced into graphql:main Jun 9, 2022
@yaacovCRyaacovCR deleted the align branch June 9, 2022 19:41
@yaacovCR

See further discussion with respect to advantages of using repeaters about general anti pattern of Promise<AsyncIterator>

@yaacovCR

@brainkim

Sign up for free to join this conversation on . Already have an account? Sign in to comment
PR: breaking change 💥implementation requires increase of "major" version number
None yet

Successfully merging this pull request may close these issues.