Skip to content

Commit 63251e5

Browse files
author
David Žaba
committed
fix: TypeError When Deleting Nested Data
1 parent a7a3aa7 commit 63251e5

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/module/actions.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export default function (firestoreConfig: FirestoreConfig): AnyObject {
180180
.set(initialDocPrepared)
181181
.then(() => {
182182
if (state._conf.logging) {
183-
const message = 'Initial doc succesfully inserted'
183+
const message = 'Initial doc successfully inserted'
184184
console.log(
185185
`%c [vuex-easy-firestore] ${message}; for Firestore PATH: ${getters.firestorePathComplete} [${state._conf.firestorePath}]`,
186186
'color: SeaGreen'
@@ -1150,15 +1150,15 @@ export default function (firestoreConfig: FirestoreConfig): AnyObject {
11501150
}
11511151
return storeUpdateFn(ids)
11521152
},
1153-
_stopPatching ({ state, commit }) {
1153+
_stopPatching ({ state }) {
11541154
if (state._sync.stopPatchingTimeout) {
11551155
clearTimeout(state._sync.stopPatchingTimeout)
11561156
}
11571157
state._sync.stopPatchingTimeout = setTimeout(_ => {
11581158
state._sync.patching = false
11591159
}, 300)
11601160
},
1161-
_startPatching ({ state, commit }) {
1161+
_startPatching ({ state }) {
11621162
if (state._sync.stopPatchingTimeout) {
11631163
clearTimeout(state._sync.stopPatchingTimeout)
11641164
}

src/module/getters.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { getPathVarMatches } from '../utils/apiHelpers'
77
import setDefaultValues from '../utils/setDefaultValues'
88
import { AnyObject } from '../declarations'
99
import error from './errors'
10+
import firebase from 'firebase/compat'
11+
import FieldValue = firebase.firestore.FieldValue;
1012

1113
export type IPluginGetters = {
1214
firestorePathComplete: (state: any, getters?: any, rootState?: any, rootGetters?: any) => string
@@ -145,11 +147,13 @@ export default function (firebase: any): AnyObject {
145147
id = getters.docModeId
146148
cleanedPath = path
147149
}
148-
cleanedPatchData[cleanedPath] = firebase.firestore.FieldValue.delete()
150+
151+
cleanedPatchData[cleanedPath] = FieldValue.delete()
149152
cleanedPatchData.id = id
153+
150154
return { [id]: cleanedPatchData }
151155
},
152-
prepareForInsert: (state, getters, rootState, rootGetters) => (items = []) => {
156+
prepareForInsert: (state, getters) => (items = []) => {
153157
// add fillable and guard defaults
154158
return items.reduce((carry, item) => {
155159
// set default fields

0 commit comments

Comments
 (0)