for some reason it is throwing me an error in the console "TypeError: n.indexOf is not a function" and I do not understand very well why it happens. I am using Firestore and Firebase v9 Modular and basically it is a function that creates a category in firestore database and also inside the category creates a test task.
Here is the full error:
TypeError: n.indexOf is not a function
at Function.fromString (index.esm2017.js:1032)
at va (index.esm2017.js:14990)
at App.jsx:48
And the line 48 in the error message is:
const taskRef = doc(collection(db, "categorias"), where("uid", "==", currentUser), newDocRef.id)
Here is my code :)
const currentUser = '1234'
const crearCategoria = useCallback(async() => {
try {
const newDocRef = doc(collection(db, "categorias"));
await setDoc(newDocRef, {
name: categoryName,
uid: currentUser,
projectId: newDocRef.id
})
const taskRef = doc(collection(db, "categorias"), where("uid", "==", currentUser), newDocRef.id)
await setDoc(taskRef, {
name: 'prueba',
uid: currentUser,
projectId: newDocRef.id
})
} catch (error) {
console.log(error)
}
})