useFirestoreDocData & useFirestoreDoc won't throw a promise on permission denied
@jhuleatt 已经在做这个了。
开始于 2019年12月10日。
评估
这个 Issue 还没有评估数据。
描述
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'
- 主要语言
- TypeScript
- 星标
- 3.6k
- 派生
- 403
- 平均合并
- 5 天 1 小时
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
FirebaseExtended/reactfire 的其他 Issue
-
难度 5/5 一周以上 新手友好度 38/100
FirebaseExtended/reactfire#801 ·
-
v5
难度 4/5 3-5 天 新手友好度 48/100
FirebaseExtended/reactfire#793 ·
-
v5
难度 4/5 3-5 天 新手友好度 35/100
FirebaseExtended/reactfire#790 · 2 条评论 ·
-
v5
难度 4/5 3-5 天 新手友好度 55/100
FirebaseExtended/reactfire#789 ·
-
难度 5/5 一周以上 新手友好度 35/100
FirebaseExtended/reactfire#788 ·
查看 FirebaseExtended/reactfire 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
bcgov/bc-wallet-mobile#4761 · 1 条评论 ·
-
external-issue to-triage
难度 2/5 1-3 小时 新手友好度 88/100
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100
-
难度 2/5 1-3 小时 新手友好度 82/100
-
refactor
难度 2/5 1-3 小时 新手友好度 84/100