-
-
Notifications
You must be signed in to change notification settings - Fork 553
v2.0.0 alpha #162
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
Merged
Merged
v2.0.0 alpha #162
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # src/reducer.js # src/utils/query.js
#### What's this PR do? The promise from 'uploadFile' now returns an object of the file data is decorated with a `pushKey` property that is the key generated by the call to `firebase.push`. This change will give the caller the ability to access the urls, name and key for additional processing. #### What are the important parts of the code? a single `.then` with a spread #### How should this be tested by the reviewer? Ensure the caller of this function has access to the fileData in the returned promise. #### Is any other information necessary to understand this? This change is proposed as the caller may need to dispatch additional actions for use with redux/redux-observable that contain the information contained in the fileData.
**NOTE:** [The original pull request](#81) for this feature and its branch have the `dist` files included in git tracking (so the branch could be referenced in package files). This pull request does not include `dist` files. ## Features * Initial support for `react-native` (should solve #80) * Import only needed sections of Firebase library ( #72 and #53 ) ## Notes About react-native Support for `react-native` is still in the early testing phases. That means the API and/or functionality may change. If using `react-native`, make sure you have the following config enabled when creating your store: ```js import ReactNative from 'react-native' import { compose, createStore } from 'redux'; import { reactReduxFirebase } from 'react-redux-firebase' const firebaseConfig = {} // your firebase config object const initialState = { firebase: { authError: null } }; // then in your config when creating store const store = createStore( makeRootReducer(), initialState, compose( reactReduxFirebase( firebaseConfig, { rn: ReactNative, enableRedirectHandling: false, userProfile: 'users' }, ), ) ); ``` Normal authentication methods, such as `firebase.login({provider: 'google', type: 'popup'})`, will not work due to Firebase's js library (used internally) not completely supporting `react-native`. That means you must use `firebase.auth().signInWithCredential(credential)` until there is more support within the Firebase library. It might look something like this (untested): ```js let credential = this.props.firebase.auth.GoogleAuthProvider.credential(token); this.props.firebase.auth().signInWithCredential(credential) .then(() => { console.log('auth successful') }) .catch((err) => { console.log('error: ', err) }) ```
* Auth working using `signInWithAuthCredential` - Unsupported Browser error fixed by importing firebase using `import * as firebase from ‘firebase’` instead of separate section imports * react-native complete example now using isLoaded and displaying data from react-redux-firebase
* Switched to using ReactNative instead of rn * Roadmap updated with `react-native` stuff * react-native complete example README added
### Breaking Changes
* react-native is now used differently in config when creating store which breaks `v1.4.0-alpha` ("rn" was not as clear as "ReactNative"). Use the following config when creating store:
```js
import { reactReduxFirebase } from 'react-redux-firebase'
import { AsyncStorage } from 'react-native'
const fbConfig = {} // your firebase config object
reactReduxFirebase(fbConfig, {
ReactNative: { AsyncStorage } // now under "ReactNative" instead of "rn"
// enableRedirectHandling: false // no longer needed
})
```
* firebase library imported using `import * as firebase from 'firebase'` instead of piece by piece to fix Unsupported Browser error from `v1.4.0-alpha` (thanks @kudorori - full details in #87). Could have impact on #52, #72, or #80.
### Features
* [react-native complete example](https://github.com/prescottprue/react-redux-firebase/tree/v1.4.0-beta/examples/complete/react-native) added showing authentication
* firebase library updated to `v3.7.3`
* Package quality image added to README
* Docs updated with react-native changes
* fix using with yarn - `.npmignore` file removed so that `.yarn.lock` file will not be included in npm release (only files listed in package file `files` property) * `pushWithMeta`, `setWithMeta`, and `updateWithMeta` methods added - write to firebase with createdAt/updatedAt and createdBy/updatedBy
* Only importing used parts of Firebase Library (fixes self undefined issue) ```js import * as firebase from 'firebase' // switched to import * as firebase from 'firebase/app' import 'firebase/auth' import 'firebase/database' import 'firebase/storage' ```
# Conflicts: # package.json
* made use of [`hoist-non-react-statics`](https://github.com/mridgway/hoist-non-react-statics) (following pattern set forth in [`react-redux`'s connect](https://github.com/reactjs/react-redux/blob/master/src/components/connectAdvanced.js#L281)) to fix issue where statics where not being passed. For example, when using `StackNavigator` with react-native: ```js @firebaseConnect() // <- was keeping statics from being passed @connect(({ firebase }) => ({ // <- hoists statics auth: pathToJS(firebase, 'auth') })) export default class Home extends Component { static navigationOptions = { // <- was not being passed to resulting wrapped component title: 'Some Title' } render () { return ( <View> <Text>React Native + Firebase!</Text> </View> ) } } ``` * create your own react-native app instructions added to docs (including pictures) * user and credential are now returned from login method (solves #106) * `onRedirectResult` config option added (runs when redirect result occurs) * Material-ui complete example updated to use field level validation * Docs added for `onAuthStateChanged` and `onRedirectResult` config options
* #107 - `build:size` npm script added to generate size report for minified bundle * #109 - Firebase version is not fixed - all v1.4.0-* versions use `^` on firebase * Multiple Dependencies and Dev Dependencies updated (including `firebase` and `jwt-decode`) * Yarn file updated * Compose tests improved promise handling (better use of `chai-as-promised`) * Linting removed from updated `eslint-config-standard` rules
# Conflicts: # README.md # examples/complete/material/src/constants/formNames.js # examples/complete/material/src/routes/Account/containers/AccountContaine r.js # examples/complete/material/src/routes/Login/components/LoginForm/LoginFo rm.js # examples/complete/material/src/routes/Login/containers/LoginContainer.js # examples/complete/material/src/routes/Signup/components/SignupForm/Signu pForm.js # examples/complete/material/src/routes/Signup/containers/SignupContainer. js
# Conflicts: # README.md # examples/complete/material/src/constants/formNames.js # examples/complete/material/src/routes/Account/containers/AccountContaine r.js # examples/complete/material/src/routes/Login/components/LoginForm/LoginFo rm.js # examples/complete/material/src/routes/Login/containers/LoginContainer.js # examples/complete/material/src/routes/Signup/components/SignupForm/Signu pForm.js # examples/complete/material/src/routes/Signup/containers/SignupContainer. js
* `notParsed` query parameter added * #121 addressed - dispatch of main data called after child dispatches have already been called
Signed-off-by: petetnt <[email protected]>
### Description Non-breaking small feature addition to profile parameter population. Profile population will now work on a list of UIDs, key:value pairs, and a single UID (which was already supported)
# Conflicts: # docs/recipes/auth.md # docs/roadmap.md # examples/complete/material/src/routes/Home/components/NewTodoPanel/NewTo doPanel.js # examples/complete/material/src/routes/Home/components/TodoItem/TodoItem. js # examples/complete/material/src/routes/Home/containers/HomeContainer.js # examples/complete/material/src/routes/Login/components/LoginForm/LoginFo rm.js # examples/complete/material/src/routes/Projects/components/NewProjectDial og/NewProjectDialog.js # examples/complete/material/src/routes/Projects/containers/ProjectsContai ner.js # examples/complete/material/src/routes/Projects/routes/Project/components /Project/Project.js # examples/complete/material/src/routes/Recover/components/EmailForm/Email Form.js # examples/complete/material/src/routes/Recover/components/RecoverForm/Rec overForm.js # examples/complete/material/src/routes/Recover/containers/RecoverContaine r.js # examples/complete/simple/src/Home.js # examples/complete/simple/src/TodoItem.js # examples/snippets/decorators/App.js # examples/snippets/decorators/TodoItem.js # examples/snippets/multipleQueries/App.js # examples/snippets/multipleQueries/TodoItem.js # examples/snippets/populates/App.js # examples/snippets/stateBasedQuery/App.js # package.json # src/connect.js # tests/unit/connect.spec.js
Adds various features supporting `populates` that we found to be missing for our use-case. I've ensured the tests pass and functionally everything appears to work. We could consider splitting this PR up if some features are deemed undesired for merge. - Adds support for lodash supported path syntax in `populates.child`, e.g. `this.is.a.nested.prop`. This was added to support populating on ids that may be nested arbitrarily in the top level object and primarily required changing direct JS prop accessors `foo[bar], foo.bar` to `_.get(foo, bar)` - Adds support for per-item populates configurations by specifying a function callback that generates the populates configuration from the top level (key, item) tuple. This enables dynamically populating items, such as using the top level key when building the `root` path, or to only populate items passing a test when querying for a list. - Adds support for `storeAs` when `populates` is configured to continue working around #130 - is there a reason why this shouldn't work?
### Description * Adds `updateProfile`, `updateAuth`, and `updateEmail` methods that dispatch associated start/success/failure actions * Adds multiple features to populate - #132 * Uses `prop-types` instead of importing from react - #122 * `distpatchOnUnsetListener` fixed to be `dispatchOnUnsetListener` (depreciation warning added along with a test confirm it is displayed) * Do not include `dbPath` in response from `deleteFile` method if it is undefined (test added to check this case) * `.eslintrc` file now using yaml format instead of JSON format (easier to read) * Unnessesary global eslint comments removed from tests (no longer needed due to globals being moved to `.eslintrc`) * `enableEmptyAuthChanges` config option added - #137 ### Check List - [X] All tests passing - [X] Docs updated with any changes or examples - [X] Added tests to ensure feature(s) work properly ### Relevant Issues * [#122](https://github.com/prescottprue/react-redux-firebase/issues/#122) * [#132](https://github.com/prescottprue/react-redux-firebase/issues/#132) * [#137](https://github.com/prescottprue/react-redux-firebase/issues/#137)
# Conflicts: # docs/roadmap.md # package.json
### Description Removed `browser` field from `package.json` in attempt to solve #128 ### Check List - [X] All tests passing - [X] Docs updated with any changes or examples ### Relevant Issues * [#128](https://github.com/prescottprue/react-redux-firebase/issues/#128)
* Typescript typings added - #142 * Webpack updated to version 2 (with matching changes to config) * redux-persist recipe added to docs (uses [`redux-persists-transform-immutable`](https://github.com/rt2zz/redux-persist-transform-immutable))
### Description Webpack 2 doesn't allow to mix import/export with module.exports. This forbids to use src in webpack, which is required for dead code elimination (tree shaking) to work.
unWatchEvent was not passing the correct queryId or path param (i.e. matching params passed to watchEvent), causing internal firebase._.watchers to continuously grow due to unsetWatcher being unable to resolve the watcher. This manifests as open firebase subscriptions continuing to grow, even when then the component that issued the query that opened the subscription is unmounted. PR fixes the passed params so that unsetWatcher is able to clean up the watchers on unmount. Best test case for this is probably to compare that firebase._.watchers map after component mount and component unmount, and compare this PR against behavior on master.
It helps to use more than one firebase app by creating separate store for each one, it may be enough to fix #29
* Switched to using `.npmignore` instead of `files` and `filesMap` fields in package.json to get typescript typings to be published - #142
# Conflicts: # package.json
# Conflicts: # package.json
* Basic Population working with new syntax (`populate`) * Material example uses new syntax * A firebase instance can be passed * Unused helpers removed (populatedDataToJS, dataToJS, customToJS)
prescottprue
added a commit
that referenced
this pull request
Jun 20, 2017
* Basic Population working with new syntax (`populate`) * Material example uses new syntax (no helpers) * A firebase instance can be passed (pass Firebase instance as first argument for `reactReduxFirebase` when creating store) * Unused helpers removed (`populatedDataToJS`, `dataToJS`, `customToJS`)
3 tasks
prescottprue
added a commit
that referenced
this pull request
Jun 23, 2017
### Description * Adds versions capability to docs through [versions-select plugin](https://github.com/prescottprue/gitbook-plugin-verions-select) * Simplifies pull request template * Fixes typo causing error while building gitbook (`objectivec` instead of `objc` for prism plugin) ### Check List - [X] All tests passing - [X] Docs updated with any changes or examples - [X] Added tests to ensure feature(s) work properly ### Relevant Issues * #154 * #162
prescottprue
added a commit
that referenced
this pull request
Jun 23, 2017
* Adds versions capability to docs through [versions-select plugin](https://github.com/prescottprue/gitbook-plugin-verions-select) * Simplifies pull request template * Fixes typo causing error while building gitbook (`objectivec` instead of `objc` for prism plugin) - [X] All tests passing - [X] Docs updated with any changes or examples - [X] Added tests to ensure feature(s) work properly * #154 * #162
prescottprue
added a commit
that referenced
this pull request
Jun 23, 2017
* Adds versions capability to docs through [versions-select plugin](https://github.com/prescottprue/gitbook-plugin-verions-select) * Simplifies pull request template * Fixes typo causing error while building gitbook (`objectivec` instead of `objc` for prism plugin) - [X] All tests passing - [X] Docs updated with any changes or examples - [X] Added tests to ensure feature(s) work properly * #154 * #162
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
populate)reactReduxFirebasewhen creating store)populatedDataToJS,dataToJS,customToJS)