useFirestoreDocData & useFirestoreDoc won't throw a promise on permission denied
@jhuleatt ci sta già lavorando.
Dal 10/12/2019.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Version info
React: 16.12.0
Firebase: 7.5.2
ReactFire: 2.0.0-canary.1fce6b9
Test case
I want to use role based authentication on documents, so when a document is successfully read in the app and then I change the access of that user, the listener throws an error instead of a Promise.
const CompanyCheck: React.FC = ({ children }) => {
const { companyId, setCompany } = useCompanyContext();
const firestore: Firebase['Firestore'] = useFirestore();
const companyRef = useRef(
firestore()
.collection('companies')
.doc(companyId)
);
useEffect(() => {
companyRef.current = firestore()
.collection('companies')
.doc(companyId);
}, [companyId, firestore]);
// This won't throw a promise on permission changes after successfull read.
const companyDoc = useFirestoreDocData<Company>(companyRef.current);
useEffect(() => {
setCompany(companyDoc);
}, [companyDoc, setCompany]);
return <>{children}</>;
};
Steps to reproduce
Use a correct example of read operation with role access, then once the data is displayed remove the access to the document and error boundary won't catch any error.
Expected behavior
Throw a promise like when initial read fails so ErrorBoundary can catch the error.
Actual behavior
Don't throw a Promise and error can't be handled. Error message is: 'permission-denied'
- Lingua principale
- TypeScript
- Stelle
- 3.6k
- Fork
- 403
- Merge medio
- 5g 1h
- PR unite (30g)
- 10
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di FirebaseExtended/reactfire
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
FirebaseExtended/reactfire#801 ·
-
v5
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
FirebaseExtended/reactfire#793 ·
-
v5
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
FirebaseExtended/reactfire#790 · 2 commenti ·
-
v5
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
FirebaseExtended/reactfire#789 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
FirebaseExtended/reactfire#788 ·
Tutte le issue di FirebaseExtended/reactfire
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
security
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
IBM/node-sdk-core#373 ·
-
e2e-failure ready-to-code
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100