Skip to content

Commit 33337e9

Browse files
authored
Merge pull request #431 from prescottprue/v2.0.6
v2.0.6
2 parents 099e83e + 6f97895 commit 33337e9

File tree

5 files changed

+58
-37
lines changed

5 files changed

+58
-37
lines changed

docs/storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Available on `props.firebase` if using `firebaseConnect` HOC or using `getFireba
3434
- `options.name` [**String**][string-url] | [**Function**][function-url] - Name of file or function that returns the name of the file. If a function is passed the argument syntax is `(file, internalFirebase, uploadConfig)` where `file` is the file object (`file.name` is used as default if no name option is passed).
3535

3636
##### Returns
37-
[**Promise**][promise-url] Resolves with an object containing `uploadTaskSnaphot` which is the [**firebase.storage.UploadTaskSnaphot**][upload-task-snapshot-url] returned from the `storageRef.put` call which happens internally. If `databasePath` is provided `snapshot`, `key`, `File`, and `metaDataSnapshot` parameters are also included.
37+
[**Promise**][promise-url] Resolves with an object containing `uploadTaskSnapshot` which is the [**firebase.storage.UploadTaskSnapshot**][upload-task-snapshot-url] returned from the `storageRef.put` call which happens internally. If `databasePath` is provided `snapshot`, `key`, `File`, and `metaDataSnapshot` parameters are also included.
3838

3939
#### Examples
4040

package-lock.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-redux-firebase",
3-
"version": "2.0.5",
3+
"version": "2.0.6",
44
"description": "Redux integration for Firebase. Comes with a Higher Order Components for use with React.",
55
"main": "lib/index.js",
66
"module": "es/index.js",

src/actions/query.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ export const watchEvent = (firebase, dispatch, options) => {
3535
isQuery,
3636
storeAs
3737
} = options
38+
const { config: { enableLogging, logErrors } } = firebase._
39+
3840
const watchPath = !storeAs ? path : `${path}@${storeAs}`
3941
const id = queryId || getQueryIdFromPath(path)
4042
const counter = getWatcherCount(firebase, type, watchPath, id)
@@ -159,7 +161,19 @@ export const watchEvent = (firebase, dispatch, options) => {
159161
})
160162
},
161163
err => {
162-
dispatch({ type: actionTypes.ERROR, payload: err })
164+
if (enableLogging || logErrors) {
165+
// eslint-disable-next-line no-console
166+
console.log(
167+
`RRF: Error retrieving data for path: ${path}, storeAs: ${storeAs}. Firebase:`,
168+
err
169+
)
170+
}
171+
dispatch({
172+
type: actionTypes.ERROR,
173+
storeAs,
174+
path,
175+
payload: err
176+
})
163177
}
164178
)
165179
}

src/actions/storage.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,21 +90,27 @@ export const uploadFile = (dispatch, firebase, config) => {
9090
.put(file)
9191

9292
return uploadPromise()
93-
.then(uploadTaskSnaphot => {
93+
.then(uploadTaskSnapshot => {
9494
if (!dbPath || !firebase.database) {
9595
dispatch({
9696
type: FILE_UPLOAD_COMPLETE,
9797
meta: { ...config, filename },
98-
payload: { uploadTaskSnaphot }
98+
payload: {
99+
uploadTaskSnapshot,
100+
uploadTaskSnaphot: uploadTaskSnapshot // Preserving legacy typo
101+
}
99102
})
100-
return { uploadTaskSnaphot }
103+
return {
104+
uploadTaskSnapshot,
105+
uploadTaskSnaphot: uploadTaskSnapshot // Preserving legacy typo
106+
}
101107
}
102-
const { metadata: { name, fullPath, downloadURLs } } = uploadTaskSnaphot
108+
const { metadata: { name, fullPath, downloadURLs } } = uploadTaskSnapshot
103109
const { fileMetadataFactory } = firebase._.config
104110

105111
// Apply fileMetadataFactory if it exists in config
106112
const fileData = isFunction(fileMetadataFactory)
107-
? fileMetadataFactory(uploadTaskSnaphot, firebase)
113+
? fileMetadataFactory(uploadTaskSnapshot, firebase)
108114
: {
109115
name,
110116
fullPath,
@@ -122,7 +128,8 @@ export const uploadFile = (dispatch, firebase, config) => {
122128
snapshot: metaDataSnapshot,
123129
key: metaDataSnapshot.key,
124130
File: fileData,
125-
uploadTaskSnaphot,
131+
uploadTaskSnapshot,
132+
uploadTaskSnaphot: uploadTaskSnapshot, // Preserving legacy typo
126133
metaDataSnapshot
127134
}
128135
dispatch({

0 commit comments

Comments
 (0)