🐛 Fix double-nested properties in client screenshot payload#225
🐛 Fix double-nested properties in client screenshot payload#225
Conversation
The client was sending the entire options object as `properties`,
so when SDKs passed `{ properties: { url } }`, the server received
`properties: { properties: { url } }` — making `url` unreachable.
Now the client destructures SDK options (`fullPage`, `threshold`)
out and flattens `options.properties` into the top-level properties
object, so metadata like `url` is always directly accessible.
Vizzly - Visual Test ResultsCLI Reporter - 1 change needs review
|
Code ReviewSummaryThis is a clean fix that properly addresses the double-nesting bug introduced when SDKs started passing ✅ Strengths1. Root Cause Fix
2. Clean Implementation let { fullPage, threshold, properties: userProperties, ...rest } = options;
properties: { ...rest, ...userProperties }
3. Excellent Test Coverage
4. Backward Compatible
🔍 Observations1. Option Precedence is Correct
2. Edge Case Handling
3. Potential Future Consideration 🧪 Test QualityTest: "flattens nested properties"
Test: "excludes SDK options from properties"
Possible Enhancement (not blocking): await vizzlyScreenshot('test', buffer, {
browser: 'chrome',
properties: { browser: 'firefox', url: 'http://example.com' }
});
// Expected: properties.browser === 'firefox' (nested wins)🎯 Overall AssessmentCode Quality: ⭐⭐⭐⭐⭐
Bug Fix Correctness: ⭐⭐⭐⭐⭐
Test Coverage: ⭐⭐⭐⭐⭐
Documentation: ⭐⭐⭐⭐
✅ RecommendationApprove and merge. This is a well-implemented fix with strong test coverage. The approach is sound, the code is clean, and there are no identified risks. The fix properly resolves issue #221 and eliminates the need for server-side workarounds. No blocking issues found. |

Summary
optionsobject asproperties, causing double-nesting when SDKs passed{ properties: { url } }— the server receivedproperties: { properties: { url } }makingurlunreachablefullPage,threshold) out and flattensoptions.propertiesinto the top-level properties objectContext
After the URL capture change (#220), Storybook and Static Site SDKs passed
{ properties: { url: page.url() } }tovizzlyScreenshot(). The client blindly forwarded the whole options object asproperties, double-nesting the data. A server-side fallback (properties.properties?.url) was deployed as a stopgap — this fix makes that fallback unnecessary.Test plan
npm test— 1894 pass, 0 failnpm run lint— clean{ properties: { url } }flattens to{ url }in the payloadfullPageandthresholdare excluded from properties