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

Binding { type: 'once', ... } fires Query.off which returns an error #36

Closed
DeividasK opened this issue Jan 21, 2017 · 5 comments · Fixed by #37
Closed

Binding { type: 'once', ... } fires Query.off which returns an error #36

DeividasK opened this issue Jan 21, 2017 · 5 comments · Fixed by #37
Assignees

Comments

@DeividasK
Copy link

Hi there!

I get an error after binding the data once, like this:

@firebaseConnect((props) => ([
  { type: 'once', path: DH.getUserProfile(props.uid) },
  { type: 'once', path: DH.getUserGoalsPath(props.uid) },
]))

Below is the error I get:

database.js:130 Uncaught Error: Query.off failed: first argument must be a valid event type: "value", "child_added", "child_removed", "child_changed", or "child_moved".
    at jf (http://localhost:8080/index.js:37664:156)
    at U.g.Ic (http://localhost:8080/index.js:37707:59)
    at unsetWatcher (http://localhost:8080/index.js:36456:46)
    at unWatchEvent (http://localhost:8080/index.js:34494:35)
    at http://localhost:8080/index.js:34516:13
    at Array.forEach (native)
    at unWatchEvents (http://localhost:8080/index.js:34515:18)
    at FirebaseConnect.componentWillUnmount (http://localhost:8080/index.js:31687:37)
    at http://localhost:8080/index.js:23652:26
    at measureLifeCyclePerf (http://localhost:8080/index.js:23318:13)

I figure this is because 'once' does not have any watchers which should be unset. However, couldn't find a fix in the code. Would appreciate your help on this one!

@prescottprue prescottprue self-assigned this Jan 22, 2017
@prescottprue
Copy link
Owner

Just to confirm I get the reproduction of the problem right, which version are you using?

@DeividasK
Copy link
Author

v1.1.5

@prescottprue
Copy link
Owner

Try v1.2.0-rc.2 and see if it fixes it for you. It skips calling off for once

@DeividasK
Copy link
Author

Fix works.

@prescottprue
Copy link
Owner

Great to hear! Planning on releasing v1.2.0 in a few minutes (which will include this fix).

prescottprue added a commit that referenced this issue Jan 23, 2017
## Breaking Changes
- Data gathered during population is now normalized in redux [following defined redux practice of normalizing](http://redux.js.org/docs/recipes/reducers/NormalizingStateShape.html) (instead of placed directly into nested object). **THIS BREAKS v1.1.5 AND EARLIER IMPLEMENTATIONS OF POPULATE**. Now population will require the usage of `populatedDataToJS`.
- `populatedDataToJS` function added to helpers (returns data populated from normalized state)
- `profileDecorator` config option renamed to `profileFactory` for clarity (`profileDecorator` still supported, but will throw deprecation warning)
- default file metadata written to database includes `downloadURL` instead of `downloadURLs` array
- Meta values (`timestamp`, `requesting`, `requested`) are now stored by string key (keeps invalid keyPath error from showing up)
- `enableRedirectHandling` config param added to enable/disable auth redirect handling (enabled by default, which can cause breakage in none HTTP/HTTPS environments)

## Enhancements
- `once` queries no longer cause `off` error due to unmounting non existent listener (fixes #36)
- login with auth redirect no longer returns null  and other redirect handling improvements (#33)
- deep set `invalid keyPath` error fixed in data section of reducer (deep list is null first then has value)
- `fileMetadataFactory` config option added to allow control of metadata written to database when using `uploadFile` and `uploadFiles`
- Profile Params Populate now working for both object and string notation
- Config params type validation
- Roadmap updated with `v2.0.0` plans
- `profileDecorator` backwards compatibility is included (with a deprecation warning)
- `CODE_OF_CONDUCT.md` and `PATRONS.md` added
- Docs + Tests updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants