Skip to content

feat: expose subscriptions limited availability#841

Merged
raluik merged 35 commits into
masterfrom
rando/prod-2111
May 21, 2026
Merged

feat: expose subscriptions limited availability#841
raluik merged 35 commits into
masterfrom
rando/prod-2111

Conversation

@raluik
Copy link
Copy Markdown
Contributor

@raluik raluik commented May 14, 2026

Let's consumers handle state where some subscriptions fail.

Checklist

  • Code is covered with tests.

Comment thread packages/javascript-api/src/lib/services/graphql/graphql.service.ts
if (query.kind === 'Document') {
return print(query);
}
throw new Error('queryToString: query must be a string or a DocumentNode');
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous checks were exhaustive.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: shouldn't we keep in mind consumers who may not use typescript? Especially if they try to pass a query that can be handled by print, but is not a DocumentNode, the results can be confusing
I'd keep the old checks, but maybe adjust the message, we don't need to include the function name

Copy link
Copy Markdown
Contributor Author

@raluik raluik May 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add the checks back as we're pressed for time.

Not gonna look into the invalid query or Javascript questions atm (were there before), but could be issues yup. Good thinking!

Comment thread packages/javascript-api/src/lib/services/graphql/graphql.service.ts Outdated
Comment thread packages/javascript-api/src/lib/services/graphql/graphql.service.ts
Comment thread packages/javascript-api/src/lib/services/graphql/graphql.service.ts
@raluik raluik marked this pull request as ready for review May 19, 2026 18:24
@raluik raluik requested a review from KonradPaluch May 20, 2026 13:07
shareReplay(1),
);

this.retryableErroredSubscriptionsMessageIds$.subscribe();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually considering removing this. But will tackle with rest of changes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nah, we need it as it's being used in retry logic.

Copy link
Copy Markdown

@KonradPaluch KonradPaluch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

two blocking comments

  • removeEventListener handler reference
  • type safety in parseQuery

messageId: message.id,
});

this.messagesSubscribers.get(message.id)?.next(message.payload.data);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: maybe message.payload?.data in case an empty message arrives?

if (query.kind === 'Document') {
return print(query);
}
throw new Error('queryToString: query must be a string or a DocumentNode');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: shouldn't we keep in mind consumers who may not use typescript? Especially if they try to pass a query that can be handled by print, but is not a DocumentNode, the results can be confusing
I'd keep the old checks, but maybe adjust the message, we don't need to include the function name

if (typeof window !== 'undefined') {
window.removeEventListener('offline', this.sendPingWithThisBound);
window.addEventListener('offline', this.sendPingWithThisBound);
window.removeEventListener('offline', () => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we need to pass the same function to remove listener as we did to add listener. An arrow function is always a new one

@raluik raluik requested a review from KonradPaluch May 21, 2026 12:06
Copy link
Copy Markdown

@KonradPaluch KonradPaluch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@raluik raluik added this pull request to the merge queue May 21, 2026
Merged via the queue into master with commit f8f6ea6 May 21, 2026
10 checks passed
@raluik raluik deleted the rando/prod-2111 branch May 21, 2026 12:13
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.

2 participants