Skip to content
Merged
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
v2.5.1 remove lifecycle warning of using componentWillMount
  • Loading branch information
lidaof committed Jun 23, 2020
commit 834b1751d8f8ad43b2c52b16e3a6b47bb27efce7
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-redux-firebase",
"version": "2.5.0",
"version": "2.5.1",
"description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
6 changes: 4 additions & 2 deletions src/firebaseConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { v3ErrorMessage } from './constants'
*/
export const createFirebaseConnect = (storeKey = 'store') => (
dataOrFn = []
) => WrappedComponent => {
) => (WrappedComponent) => {
class FirebaseConnect extends Component {
static displayName = `FirebaseConnect(${getDisplayName(WrappedComponent)})`
static wrappedComponent = WrappedComponent
Expand All @@ -39,7 +39,9 @@ export const createFirebaseConnect = (storeKey = 'store') => (
prevData = null
store = this.context[storeKey]

componentWillMount() {
/* eslint-disable camelcase */
UNSAFE_componentWillMount() {
/* eslint-enable camelcase */
// Throw if using with react-redux@^6
if (!this.context || !this.context[storeKey]) {
// Use react-redux-firebase@^3 for react-redux@^6 support. More info available in the migration guide: http://bit.ly/2SRNdiO'
Expand Down
13 changes: 9 additions & 4 deletions src/firestoreConnect.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { v3ErrorMessage } from './constants'
*/
export const createFirestoreConnect = (storeKey = 'store') => (
dataOrFn = []
) => WrappedComponent => {
) => (WrappedComponent) => {
class FirestoreConnect extends Component {
static wrappedComponent = WrappedComponent
static displayName = wrapDisplayName(WrappedComponent, 'FirestoreConnect')
Expand All @@ -40,7 +40,9 @@ export const createFirestoreConnect = (storeKey = 'store') => (
return !!this.store.firestore
}

componentWillMount() {
/* eslint-disable camelcase */
UNSAFE_componentWillMount() {
/* eslint-enable camelcase */
// Throw if using with react-redux@^6
if (!this.context || !this.context[storeKey]) {
// Use react-redux-firebase@^3 for react-redux@^6 support. More info available in the migration guide: http://bit.ly/2SRNdiO'
Expand Down Expand Up @@ -86,8 +88,11 @@ export const createFirestoreConnect = (storeKey = 'store') => (

getChanges(data = [], prevData = []) {
const result = {}
result.added = filter(data, d => !some(prevData, p => isEqual(d, p)))
result.removed = filter(prevData, p => !some(data, d => isEqual(p, d)))
result.added = filter(data, (d) => !some(prevData, (p) => isEqual(d, p)))
result.removed = filter(
prevData,
(p) => !some(data, (d) => isEqual(p, d))
)
return result
}

Expand Down