You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Optimize validateParentPath for Faster Parent Path Validation (#1396)
This commit refactors the `validateParentPath` function in `transaction-shim.ts` to improve its performance, especially for deep or frequent path validations during storage transactions.
### Optimization Details
- **Single-pass Traversal:**
The previous implementation redundantly checked object-ness and existence at each path level, sometimes re-traversing the same objects. The new approach streamlines the traversal by iterating through the parent path only once, directly walking down the value tree and stopping at the first missing or non-object parent.
- **Efficient Error Handling:**
Error construction is now more precise, and the function avoids unnecessary object checks and array slicing. The logic for setting the error's `.path` property is simplified, reducing overhead in error cases.
- **No Change in Behavior:**
All existing functionality and error semantics are preserved. The function still returns the same errors for invalid paths, but does so with less computational overhead.
0 commit comments