useFirestoreDocData & useFirestoreDoc won't throw a promise on permission denied
Maintainers usually reply within 2 days
@jhuleatt is already working on this.
Since Dec 10, 2019.
Assessment
This issue has not been assessed yet.
Description
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'
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 403
- Avg merge
- 4d 19h
- Merged PRs (30d)
- 11
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FirebaseExtended/reactfire
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
FirebaseExtended/reactfire#801 ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 48/100
FirebaseExtended/reactfire#793 ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FirebaseExtended/reactfire#790 · 2 comments ·
Maintainers usually reply within 2 days
-
v5
Difficulty 4/5 3-5 days Newbie friendliness 55/100
FirebaseExtended/reactfire#789 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
FirebaseExtended/reactfire#788 ·
Maintainers usually reply within 2 days
All issues in FirebaseExtended/reactfire
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
lichess-org/api#678 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
PostHog/posthog.com#20628 ·
Maintainers usually reply within 1 day
-
bug status:Needs Triage
Difficulty 1/5 Under an hour Newbie friendliness 92/100
jupyterlab/jupyterlab#19964 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
agentscope-ai/QwenPaw#8064 · 1 comment ·
Maintainers usually reply within 1 day
-
area: notebooks-jupyter bug theme: new notebook frontend
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
posit-dev/positron#16347 · 1 comment ·
Maintainers usually reply within 1 day