Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Disabling queries via ReactFireOptions

Đang mở
#346 1 bình luận 8 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
firebase, react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Issue nêu ReactFireOptions và ObservableStatus là các điểm vào liên quan; trước tiên hãy lần theo cách các hook của ReactFire thực thi các truy vấn và cung cấp status. So sánh hành vi enabled được đề xuất với status exists thay thế, bao gồm cả cách xử lý initialData. Công việc được xem là hoàn tất khi các truy vấn phụ thuộc có thể tránh việc thực thi ngoài ý muốn hoặc xác định đáng tin cậy sự tồn tại của một tham chiếu mà không coi dữ liệu giữ chỗ là một kết quả.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

v5

I've read the discussion in #178 and am yet another person that has run into the wall of "can't use the hooks with a not-yet-defined id". I understand and agree with your desire to keep undefined/null ids as errors. But we still run into situations where the use of react-fire hooks constrains our design decisions and requires us to make several small components that issue the same query when one query would do and would allow us to present the UI in a single component as we wish.

I suggest adopting something similar to how react-query handles this. Passing in an enabled flag to the ReactFireOptions object which would prevent the query from executing if enabled === false (and instead returning initialData, if defined). This would allow the errors to persist when inadvertently passing in undefined/null, but also allow consumers to make their own design decisions when constructing dependent queries.

Alternatively, add an exists property to the ObservableStatus so that we can determine, without an additional query, whether the ref already exists. Currently when I have a dependent query I pass in an ID that I know not to exist, e.g. "-1", but I get back a document that has a firestore-generated ID and nothing else. Without the ability to disable the query or determine if the ref exists I rely on the object being otherwise empty to determine if I should return an undefined or not.

Ngôn ngữ chính
TypeScript
Star
3.6k
Fork
403
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
10

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của FirebaseExtended/reactfire

Tất cả issue của FirebaseExtended/reactfire

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.