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

Async getData() returns the value of parent node instead of the child node. #12965

Open
kahaYu opened this issue May 14, 2024 · 3 comments
Open

Comments

@kahaYu
Copy link

kahaYu commented May 14, 2024

Description

Hello!

When I call the async getData() method, it returns the snapshot of the parent, not the actual child.

Reproducing the issue

Create User node and two nodes inside of it: id, name.

  • User
    -- id : testId
    -- name: testName

Call: let userId = try! await Database.database().reference().child("User").child("id").getData().value

It returns 2 key-value pairs id="testId", name="testName". But not the id only.

Firebase SDK Version

10.17.0

Xcode Version

15.1

Installation Method

Swift Package Manager

Firebase Product(s)

Database

Targeted Platforms

iOS

Relevant Log Output

No logs.

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@mortenbekditlevsen
Copy link
Contributor

This appears to be the same issue as #12168 and #12225.
I have an attempt at a fix here: #12169
But in a comment on #12225 back in February, 2024 @paulb777 mentions that the issue is more involved than what my fix is solving.

We are encountering hard-to-discover bugs related to this issue, and I would love to help fixing it.

@paulb777 Would it at all be possible for you to share your investigations about the extent of this issue, so that myself or others might be able to help fixing the issue?

@kahaYu
Copy link
Author

kahaYu commented May 23, 2024

Thanks for the reply @mortenbekditlevsen
Ok, will wait for the fix, until then will get the whole bundle of data and locally grab the needed fields. Which results in more spendings on Firebase though haha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants