Skip to content

Firestore: settings.ts: very minor refactor of long-polling logic. #7239

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

Merged
merged 10 commits into from
Apr 21, 2023
20 changes: 15 additions & 5 deletions packages/firestore/src/lite-api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,27 @@ export class FirestoreSettingsImpl {
}
}

this.experimentalForceLongPolling = !!settings.experimentalForceLongPolling;
this.experimentalAutoDetectLongPolling =
!!settings.experimentalAutoDetectLongPolling;
this.useFetchStreams = !!settings.useFetchStreams;

validateIsNotUsedTogether(
'experimentalForceLongPolling',
settings.experimentalForceLongPolling,
'experimentalAutoDetectLongPolling',
settings.experimentalAutoDetectLongPolling
);

if (settings.experimentalForceLongPolling) {
this.experimentalForceLongPolling = true;
this.experimentalAutoDetectLongPolling = false;
} else {
this.experimentalForceLongPolling = false;
if (settings.experimentalAutoDetectLongPolling === undefined) {
this.experimentalAutoDetectLongPolling = false;
} else {
this.experimentalAutoDetectLongPolling =
settings.experimentalAutoDetectLongPolling;
}
}

this.useFetchStreams = !!settings.useFetchStreams;
}

isEqual(other: FirestoreSettingsImpl): boolean {
Expand Down