Fix raw json field display in read only#16502
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
2 issues found across 3 files
Prompt for AI agents (all 2 issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/modules/ui/layout/expandable-list/components/ExpandedFieldDisplay.tsx">
<violation number="1" location="packages/twenty-front/src/modules/ui/layout/expandable-list/components/ExpandedFieldDisplay.tsx:50">
P2: Click-outside detection may be incorrect. `refs.domReference` is the anchor element, not the floating popup. Consider also including the floating element ref to properly detect clicks outside the popup itself. Currently, clicking on the popup itself might incorrectly trigger `onClickOutside` since only the anchor is excluded.</violation>
</file>
<file name="packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/JsonFieldDisplay.tsx">
<violation number="1" location="packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/display/components/JsonFieldDisplay.tsx:18">
P2: The click handler updates state unconditionally, but the expanded view only renders when `isRecordFieldReadOnly` is true. This causes unnecessary re-renders and may confuse users when clicking has no visible effect. Consider guarding the state update with the same condition.</violation>
</file>
Reply to cubic to teach it or ask questions. Re-run a review with @cubic-dev-ai review this PR
| }); | ||
|
|
||
| useListenClickOutside({ | ||
| refs: [refs.domReference], |
There was a problem hiding this comment.
P2: Click-outside detection may be incorrect. refs.domReference is the anchor element, not the floating popup. Consider also including the floating element ref to properly detect clicks outside the popup itself. Currently, clicking on the popup itself might incorrectly trigger onClickOutside since only the anchor is excluded.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/modules/ui/layout/expandable-list/components/ExpandedFieldDisplay.tsx, line 50:
<comment>Click-outside detection may be incorrect. `refs.domReference` is the anchor element, not the floating popup. Consider also including the floating element ref to properly detect clicks outside the popup itself. Currently, clicking on the popup itself might incorrectly trigger `onClickOutside` since only the anchor is excluded.</comment>
<file context>
@@ -0,0 +1,68 @@
+ });
+
+ useListenClickOutside({
+ refs: [refs.domReference],
+ callback: () => {
+ onClickOutside?.();
</file context>
✅ Addressed in 4d25f4a
...src/modules/object-record/record-field/ui/meta-types/display/components/JsonFieldDisplay.tsx
Show resolved
Hide resolved
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:2013 This environment will automatically shut down when the PR is closed or after 5 hours. |
Devessier
left a comment
There was a problem hiding this comment.
Great job, Mister Proust 💪
|
Hey @etiennejouan! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
Preview

Fixes #16311