vuex-easy-firestore: Error when permissions to a document are removed from a collection with openDBChannel running
Hi there,
Not sure if this is an edgecase or if I am doing something wrong… I am getting an error and sync issues when permissions to a document are removed that is inside a collection with openDBChannel running.
I have setup role based permissions to docs (I call boards
). This was done by having a roles
object on each board that has this format roles: { uid: "owner", uid: "editor"}
as suggested here.
For a user to get the boards they have permission to see I use:
const where = [
['roles.' + user.uid, 'in', ['owner', 'editor', 'viewer']]
]
dispatch('boards/openDBChannel', {clauses: { where }}, { root: true }).catch(console.error)
This works perfectly in some regards:
- New boards appear
- Boards that you are invited to appear (i.e. a field added to roles with your uid),
- Boards that are deleted disappear,
However as mentioned, boards where your permissions are removed (field removed from roles with your uid) cause the following error in console.
'compareObjectProps' can only compare objects
index.esm.js?34ed:113 [vuex-easy-firestore] Error! Something went wrong during the PATCH mutation: The document it's trying to patch does not exist.
There is then a little bit of weirdness with firebase and vuex being out of sync, that is mostly fixed with a refresh.
Any idea how to handle this case? Thanks for any help!
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (4 by maintainers)
Commits related to this issue
- v1.35.8 - Fix: openDBChannel edge case #316 — committed to mesqueeb/vuex-easy-firestore by mesqueeb 4 years ago
implemented! Thanks so much @RichardCr !!