firebase / firebase/firebase-ios-sdk
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
- Dominant language
- C++
- Stars
- 6.7k
- Forks
- 1.8k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 72
Description
### 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
```json
Replace this line with the contents of your Package.resolved.
```
### If using CocoaPods, the project's Podfile.lock
Expand Podfile.lock snippet
```yml
Replace this line with the contents of your Podfile.lock!
```
Contributor guide
Assessment
This issue has not been assessed yet.