Comments (3)
The id
property is needed for VueFire to apply certain optimizations, as noted in documentation. You will need to name your property something else. Adding a dot in front makes it annoying to use object['.id']
in v-for loops and db writes that's why it wasn't used.
Regarding other properties, that same page also explains how to add custom data to the document. Adding everything by default would bloat the data, especially in SSR.
from vuefire.
Yes, it may be annoying, but it at least does not break things which is more importance.
You will need to name your property something else.
If this issue is not planned to be fixed, this should be stated in document with highlighting.
But I think, Vuefire should use .id
internally, user can still define a custom converter to add a id
field back to the object and keep v-for clean. So that, .id
is not annoying any more. BUT, now we have NO WAY to get the real id field in document even adding custom converter since vuefire is not working properly with a "wrong" id.
Since useDocument() return VueFirestoreDocumentData, defining a global firestore converter does not make typescript happy when reading other field. Type casting or bypassing the TS rule every where is needed, it is annoying.
How about just add ref by default? If it is still too big to have a DocumentReference object, a full path string is still very useful for everyone.
I really hope this issue be fixed, this commit may help.
from vuefire.
For the moment, id
is a very practical default and will likely stay that way. What is actionable in the near future is allowing overwriting the global type so one can customize the global converters while things being typed and of course document it with some practical examples like adding the ref like you propose
from vuefire.
Related Issues (20)
- Allow alternative way to set the GOOGLE_APPLICATION_CREDENTIAL without json file HOT 1
- [Vue warn]: inject() can only be used inside setup() or functional components.
- Documentation Request: How to use emulators the correct way HOT 2
- Cannot read properties of null (reading 'photoURL') HOT 4
- Unbind `useCollection` on logout
- Realtime Database does not allow `null` despite docs? HOT 1
- Documentation of useCurrentUser
- Session Cookie Options
- Firebase Auth tree shaking HOT 3
- GOOGLE_APPLICATION_CREDENTIAL alternative for monorepos HOT 8
- Make vue-fire compatible with Ionic ? HOT 10
- Broken: "firebase.json" file doesn't exist + import issue HOT 5
- documentation error HOT 1
- typescript type definition not consistence: useDocument return null reference if document does not exist HOT 1
- Error when installing v3.1.20. - simple-git-hooks not recognized as a command HOT 6
- `databaseDefaultSerializer` exported incorrecly HOT 1
- Use multiple firestore databases HOT 1
- When using withConverter on collection it do not fetch inner refs
- returned values from `useDocument` and `useCollection` using a getter aren't reactive HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vuefire.