Conversation

betabites

Switched out the usage of XMLHttpRequest in @firebase/database for primitives from the more modern and better-supported Fetch API.

@changeset-botchangeset-bot

🦋 Changeset detected

Latest commit: b3cb399

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
NameType
@firebase/database
@firebase/database-compat
firebase

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@betabitesbetabites marked this pull request as ready for review May 15, 2025 21:50
@betabitesbetabites requested review from a team, maneesht and aashishpatil-g as code owners May 15, 2025 21:50
@Smrtnyk

I am a bit intrigued by this part "better-supported"
What exactly does that mean, better supported by who/what?

@betabites

Yeah I could've worded that better. Essentially - correct me if I'm wrong - but in modern cases, fetch is supported in all contexts where XMLHttpRequest is, plus a few additional ones. You can view the MDN docs for XMLHttpRequest and fetch for more information on availability.

Long story short:
In addition, the fetch API is also supported on service workers and server-side environments such as Deno and NodeJS. Using the Fetch API potentially widens support, while also reducing code complexity.

By 'better supported', I simply mean there's slightly more environments where the Fetch API is officially adopted & supported.

@Smrtnyk

Yeah I could've worded that better. Essentially - correct me if I'm wrong - but in modern cases, fetch is supported in all contexts where XMLHttpRequest is, plus a few additional ones. You can view the MDN docs for XMLHttpRequest and fetch for more information on availability.

Long story short: In addition, the fetch API is also supported on service workers and server-side environments such as Deno and NodeJS. Using the Fetch API potentially widens support, while also reducing code complexity.

By 'better supported', I simply mean there's slightly more environments where the Fetch API is officially adopted & supported.

gotcha, tnx for the explanation
was just curious what it exactly meant in this context of the PR

@betabites

Oh right yeah. As mentioned, fetch has slightly better support across platforms and an arguably more readable API. This PR intends to switch @firebase/database to use fetch instead, as it's more readable and has improved cross-platform support.

Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.