Compatibility with Firebase Modular JS SDK (v9)
See original GitHub issueWhat problem is this solving
Firebase recently introduced the modular web SDK, currently in beta. One of its goals is to reduce the footprint of the lib allowing tree shaking. Therefore, a lot of users might want to benefit from using it.
Using vuexfire does currently not seem to be working with the new Firebase modular SDK because of the changed API:
TypeError: document.onSnapshot is not a function
at bindDocument (webpack-internal:///./node_modules/vuexfire/dist/vuexfire.esm.js:456)
at eval (webpack-internal:///./node_modules/vuexfire/dist/vuexfire.esm.js:614)
at new Promise (<anonymous>)
at bind$1 (webpack-internal:///./node_modules/vuexfire/dist/vuexfire.esm.js:603)
at bindFirestoreRef (webpack-internal:///./node_modules/vuexfire/dist/vuexfire.esm.js:655)
See here for the new way the API works. What used to be something like this:
db.collection("cities").doc("SF")
.onSnapshot((doc) => {
console.log("Current data: ", doc.data());
});
…is now something like this:
import { doc, onSnapshot } from "firebase/firestore";
const unsub = onSnapshot(doc(db, "cities", "SF"), (doc) => {
console.log("Current data: ", doc.data());
});
That’s why I think the bindFirestoreRef(...)
now needs to be adjusted to adjust to the new API.
Proposed solution
As version 9 of the Firebase JS SDK will be the modular one, adjust to the new API so that vuefire/vuexfire works with the Firebase 9 JS SDK.
Describe alternatives you’ve considered
Stick with Version 8 of the Firebase JS SDK for now.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:33 (8 by maintainers)
Top Results From Across the Web
Upgrade from version 8 to the modular Web SDK - Firebase
Compat - a familiar API surface which is fully compatible with the version 8 SDK, allowing you to upgrade to version 9 without...
Read more >Why the New Firebase Web v9 Modular ... - DEV Community
Compatibility. The new Firebase Web v9 SDK makes it easy to progressively upgrade from the v8 SDK. The firebase package provides a compat ......
Read more >Firebase: Upgrade from version 8 to modular web SDK (v9)
A new API surface designed to removal of unused code to make your web app as small and fast as possible. As we...
Read more >Working with Firebase Version 9 Modular SDK and React ...
Firebase Modular SDK (Version 9) ... There was a recent release by Firebase; this current version came with some syntactic changes compared to ......
Read more >Refactor a React app with the new Firebase v9.x Web SDK
The new web SDK moves away from the namespace approach that was used in version 8. Instead, it adopts a modular format optimized...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Firebase v9 has been released, hope you guys release vuexfire soon. Thanks
What’s the progress on this?