-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy efficient questions monitoring #890
base: release
Are you sure you want to change the base?
Conversation
[diff-counting] Significant lines: 41. |
const questionData = change.doc.data(); | ||
const questionId = change.doc.id; | ||
|
||
if (change.type === "modified" && questionData.status === "resolved") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is only removing the questions whose status are resolved and and has been modified, would it be better to first filter the array of docChanges to keep only those that are modified and whose status is resolved. This may be optimal in cases when docChanges is big, thus we can avoid iterating through each change.
if (!isTa && !isProf) { | ||
const questionsRef = firestore.collection("questions").where("sessionId", "==", session.sessionId); | ||
|
||
unsubscribe = questionsRef.onSnapshot((snapshot) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Richard! I really like your detailed comment on what the useEffect is, it was very helpful in understanding the useEffect! Overall it looks good to me, but I was wondering if it would be a good idea to handle any potential listening errors for onSnapshot?
Summary
Deploy efficient questions monitoring and a follow-up pr to fix some build issues.
Test Plan
Notes
Breaking Changes
None