-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[WEB SDK COMPAT] await .push() returns null, but works on web sdk #893
Comments
@Salakar Anything new on this issue, still does not work for me.
This should give me the key value, but is empty. |
Hmmm It actually worked without the then, so the problem is solved in my case. Just thought that the reference key was based on what the promise returned, so I was using the 'then' to wait for that promise. This is the answer: |
@Friis1978 without the await is also correct as creating a new reference + id path via Are you able to test the following 3 scenarios on the Web SDK if you still have it handy and report back with the logs if possible, would be super helpful: // 1
const ref1 = firebase.database().ref(dbref).push();
console.log('1a', ref1.key); // should be key ?
const result = await ref1.set({ name: propValues.name, address: propValues.address });
console.log('1b', result); // should be null ?
// 2
const ref2 = await firebase.database().ref(dbref).push({ name: propValues.name, address: propValues.address });
console.log('2a', ref2.key); // should be key ?
// 3
const ref3 = await firebase.database().ref(dbref).push();
console.log('3a', ref3.key); // should be key ?
const result = await ref3.set({ name: propValues.name, address: propValues.address });
console.log('3b', result); // should be null ? Loving
|
This issue has been automatically marked as stale because it has not had recent user activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Results with firebase
|
@simonbengtsson awesome, thanks for that - looks like |
Have just pushed a re-write of the Have added test cases from this issue and others which can be seen working here: https://github.com/invertase/react-native-firebase/blob/database-fixes/tests/e2e/database/ref/push.js#L73 This will land in v5.1.0, apologies for the delay on this one. Loving
|
- [ANDROID] [BUGFIX] [DATABASE] - Database listeners now correctly tearing down between RN reloads. (Fixes #1498 #1611 #1609) - [JS] [BUGFIX] [DATABASE] - Fixed an issue where `Reference.toString()` incorrectly contains `//` instead of `/` when joining the parent and child paths. - [JS] [BUGFIX] [DATABASE] - Rework `.push()` behaviour to match WebSDK and correctly return a Reference instance in all scenarios. (Fixes #893 #1464 #1572) - [JS] [ENHANCEMENT] [UTILS] - Added a `firebase.utils().database.cleanup()` utility method which removes all database listeners.
Issue
Given the code:
If I use
await
it returns null. But on web sdk it works just fine.Just converted from firebase to react-native-firebase and faced this compatibility problem.
If I don't use
await
it works fine, but it should match the web.Related but closed: #147, #696
Environment
iOS (not tested on Android)
The text was updated successfully, but these errors were encountered: