Skip to content

Commit 70bf081

Browse files
authored
fix: Dashboard crashes when adding Parse Pointer JSON to array field in data browser (parse-community#3125)
1 parent 904497c commit 70bf081

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

src/components/BrowserCell/BrowserCell.react.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,15 @@ export default class BrowserCell extends Component {
134134
/>
135135
);
136136
});
137-
this.copyableValue = content = (
138-
<ul>
139-
{array.map(a => (
140-
<li key={a}>{a}</li>
137+
content = (
138+
<ul className={styles.pointerList}>
139+
{array.map((a, i) => (
140+
<li key={i}>{a}</li>
141141
))}
142142
</ul>
143143
);
144-
if (array.length > 1) {
145-
classes.push(styles.hasMore);
146-
}
144+
// Set copyableValue to JSON string, not JSX (to avoid infinite render loop)
145+
this.copyableValue = JSON.stringify(this.props.value);
147146
} else {
148147
this.copyableValue = content = JSON.stringify(this.props.value);
149148
}

src/components/BrowserCell/BrowserCell.scss

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,39 @@
100100
background-color: #e3effd;
101101
}
102102

103-
.hasMore {
104-
height: auto;
105-
max-height: 25px;
106-
overflow-y: scroll;
107-
padding-right: 3px;
103+
.pointerList {
104+
list-style: none;
105+
margin: 0;
106+
padding: 0;
107+
display: flex;
108+
flex-direction: column;
109+
gap: 2px;
110+
max-height: 20px;
111+
overflow-y: auto;
112+
overflow-x: hidden;
113+
108114
& > li {
109-
margin-bottom: 2px;
115+
display: block;
116+
line-height: 1.2;
117+
flex-shrink: 0;
110118
}
111119
}
112120

121+
.pointerList::-webkit-scrollbar {
122+
-webkit-appearance: none!important;
123+
width: 6px!important;
124+
}
125+
126+
.pointerList::-webkit-scrollbar-thumb {
127+
border-radius: 4px!important;
128+
background-color: rgba(0, 0, 0, .5)!important;
129+
box-shadow: 0 0 1px rgba(255, 255, 255, .5)!important;
130+
}
131+
132+
.hasMore {
133+
// No longer needed for pointer arrays, but kept for backwards compatibility
134+
}
135+
113136
.removePadding {
114137
padding-right: 3px !important;
115138
}

0 commit comments

Comments
 (0)