Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

useFirestoreDocData & useFirestoreDoc won't throw a promise on permission denied

オープン
#192 コメント 8 件 リアクション 2 件 担当者 1 名 GitHub で見る

@jhuleatt がすでに取り組んでいます。

2019年12月10日 から。

評価

この issue はまだ評価されていません。

説明

needs investigation v5
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時間
マージ済み PR(30日)
10

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FirebaseExtended/reactfire のほかの issue

FirebaseExtended/reactfire の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。