Skip to content
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

feat(logging): show collection in errors #643

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"prepare": "husky install && npm run clean && npm run build"
},
"peerDependencies": {
"firebase": "^9.0.0"
"firebase": "^10.7.2"
},
"dependencies": {
"immer": "9.0.21",
Expand Down Expand Up @@ -75,7 +75,7 @@
"eslint-plugin-jsx-a11y": "6.8.0",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "7.33.2",
"firebase": "9.23.0",
"firebase": "10.7.2",
"husky": "8.0.3",
"lint-staged": "13.3.0",
"lodash-webpack-plugin": "0.11.6",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@
!!console &&
typeof console.error === 'function' // eslint-disable-line no-console
) {
console.error('redux-firestore listener error:', err); // eslint-disable-line no-console
console.error(`redux-firestore listener error for collection "${meta?.collection}":`, err); // eslint-disable-line no-console

Check failure on line 250 in src/actions/firestore.js

View workflow job for this annotation

GitHub Actions / Build (16.x)

Replace ``redux-firestore·listener·error·for·collection·"${meta?.collection}":`,·err` with `⏎········`redux-firestore·listener·error·for·collection·"${meta?.collection}":`,⏎········err,⏎······`

Check failure on line 250 in src/actions/firestore.js

View workflow job for this annotation

GitHub Actions / Build (18.x)

Replace ``redux-firestore·listener·error·for·collection·"${meta?.collection}":`,·err` with `⏎········`redux-firestore·listener·error·for·collection·"${meta?.collection}":`,⏎········err,⏎······`

Check failure on line 250 in src/actions/firestore.js

View workflow job for this annotation

GitHub Actions / Build (20.x)

Replace ``redux-firestore·listener·error·for·collection·"${meta?.collection}":`,·err` with `⏎········`redux-firestore·listener·error·for·collection·"${meta?.collection}":`,⏎········err,⏎······`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}
dispatch({
type: actionTypes.LISTENER_ERROR,
Expand Down
3 changes: 2 additions & 1 deletion src/utils/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@
};
}

const MAX_MULTI_ACTION = 15;
/**
* Dispatch action(s) response from listener response.
* @private
Expand Down Expand Up @@ -791,7 +792,7 @@
? docData.docChanges()
: docData.docChanges;
// Dispatch different actions for doc changes (only update doc(s) by key)
if (docChanges && docChanges.length < docData.size) {
if (docChanges && docChanges.length < Math.min(MAX_MULTI_ACTION, docData.size)) {

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (16.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (18.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`

Check failure on line 795 in src/utils/query.js

View workflow job for this annotation

GitHub Actions / Build (20.x)

Replace `docChanges·&&·docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)` with `⏎····docChanges·&&⏎····docChanges.length·<·Math.min(MAX_MULTI_ACTION,·docData.size)⏎··`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does this max of 15 come from? We should note this in docs and make it an option if it isn't an amount enforced in firebase

// Loop to dispatch for each change if there are multiple
// TODO: Option for dispatching multiple changes in single action
docChanges.forEach((change, index) => {
Expand Down
Loading
Loading