ENG-3440: Fix TypeError when closing Data Catalog drawer#7925
ENG-3440: Fix TypeError when closing Data Catalog drawer#7925gilluminate merged 2 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Code Review: Fix TypeError in Data Catalog Drawer
This is a small, focused bug fix — no concerns. Summary below.
What the fix does
The root cause was an inconsistency in how privacy_declarations was accessed within the same component:
dataUseswas derived withsystem.privacy_declarations?.map(...) ?? [](null-safe)- The
onClickhandler referencedsystem.privacy_declarations[idx]directly (not null-safe)
If privacy_declarations were undefined at render time the dataUses map would produce no tags, but if the value transitioned to undefined after an initial render (e.g. after a delete mutation settled), the click handler could be called while system.privacy_declarations was momentarily undefined, throwing the TypeError described in the changelog.
Fix quality
The fix is minimal and correct:
- Declares
const declarations = system.privacy_declarations ?? [];once — always an array. - Derives
dataUsesfromdeclarations(no more optional chaining needed). - Replaces
system.privacy_declarations[idx]in theonClickhandler withdeclarations[idx].
This removes the inconsistency, guarantees both usages share the same null-coalesced value, and is consistent with the TypeScript type (PrivacyDeclarationResponse[]).
Changelog
Entry is present and correctly formatted.
Verdict
✅ LGTM — no blocking issues.
🔬 Codegraph: unavailable
💡 Write /code-review in a comment to re-run this review.
489d951 to
995092a
Compare
lucanovera
left a comment
There was a problem hiding this comment.
Confirmed the bug is fixed now. Approved!
…is undefined Extract privacy_declarations into a safe `declarations` variable with a fallback to an empty array, preventing the crash that occurs when closing the Data Catalog drawer for systems without declarations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
995092a to
c17c5d5
Compare


Ticket ENG-3440
Description Of Changes
Fixes a
TypeError: Cannot read properties of undefined (reading 'privacy_declarations')that occurs when closing the Data Catalog drawer. The crash happened becausesystem.privacy_declarationswas accessed directly without a null check in theonClickhandler, while thedataUsesderivation already used optional chaining.The fix extracts
privacy_declarationsinto a safedeclarationsvariable with a?? []fallback, then uses that reference consistently for both the data use list and the click handler.Code Changes
system.privacy_declarations ?? []into adeclarationsconstant inEditDataUseCell.tsxsystem.privacy_declarations[idx]access with safedeclarations[idx]in the Tag onClick handlerSteps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works