Compare commits

...
Author SHA1 Message Date
Sonarly Claude CodeandClaude Opus 4.6 7ed0b6ebfb Fix unhandled schema version mismatch error in SSE event stream
The SSE query subscription error handler only checked for subCode-based
errors (EVENT_STREAM_DOES_NOT_EXIST, EVENT_STREAM_ALREADY_EXISTS) but
the "Schema version mismatch" and "App version mismatch" errors from
the server don't include a subCode extension. This caused them to fall
through to the default case which threw an unhandled error to Sentry.

Handle these version mismatch errors gracefully by resetting active
query listeners and destroying the event stream, allowing it to be
recreated after the user refreshes.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
2026-02-18 17:10:04 +00:00
@@ -95,6 +95,7 @@ export const SSEQuerySubscribeEffect = () => {
} catch (error) {
if (error instanceof ApolloError) {
const subCode = error.graphQLErrors[0]?.extensions?.subCode;
const errorMessage = error.graphQLErrors[0]?.message;
switch (subCode) {
case 'EVENT_STREAM_DOES_NOT_EXIST':
@@ -104,6 +105,15 @@ export const SSEQuerySubscribeEffect = () => {
return;
}
default: {
if (
errorMessage === 'Schema version mismatch.' ||
errorMessage === 'App version mismatch.'
) {
set(activeQueryListenersState, []);
set(shouldDestroyEventStreamState, true);
return;
}
throw new Error(
`Unhandled error for event stream: ${error.message}`,
);