Skip to content

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 #12168

Open
@mortenbekditlevsen

Description

@mortenbekditlevsen

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!

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions