firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

RTDB: calling `get()` on a path where a parent path is already subscribed to, will return the entire cached parent data rather than the data for the requested path

Open mortenbekditlevsen opened this issue 2 years ago • 6 comments

Description

getData: in FRepo.m calls out to getServerValue: in FSyncTree.m. In here we find a sync point for the synchronized parent node - we create a view representing this parent sync point and then return [view completeEventCache]; - thereby disregarding that we are in fact only interested in the child node.

It seems to me like we ought to be returning [view completeEventCacheFor: relativePath] where the relativePath must then be stored from the iteration through the syncPointTree.

I will also create a PR for a fix.

Reproducing the issue

In an RTDB project, create a structure like:

"cashiers": {
  "a": { "name": "Test" },
  "b": { "name": "Test2"}
}

In the app, subscribe to "/cashiers" Then later do a get on "/cashiers/a" Notice that this returns the entire 'cashiers' node rather than the expected 'cashiers/a' node.

Firebase SDK Version

10.18.0

Xcode Version

15.0

Installation Method

Swift Package Manager

Firebase Product(s)

Database

Targeted Platforms

iOS

Relevant Log Output

No response

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!

mortenbekditlevsen avatar Dec 05 '23 11:12 mortenbekditlevsen

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

google-oss-bot avatar Dec 05 '23 11:12 google-oss-bot

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

Change back please

Nevalynn88 avatar Jan 11 '24 20:01 Nevalynn88

Change back

Nevalynn88 avatar Jan 11 '24 20:01 Nevalynn88