Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit aa6753f

Browse files
committed
Show a "more…" label when needed.
There was a bug in the Grip rep in long mode if the object had more than 10 properties. This wasn't caught by tests because we handemade the stub, which ended up not looking the same from what we actually get from the server.
1 parent 95924ca commit aa6753f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/devtools-reps/src/reps/grip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function propIterator(props, object, max) {
128128
// unquoted.
129129
const suppressQuotes = object.class === "Proxy";
130130
let propsArray = getProps(props, properties, indexes, suppressQuotes);
131-
if (Object.keys(properties).length > max) {
131+
if (Object.keys(properties).length > max || propertiesLength > max) {
132132
// There are some undisplayed props. Then display "more...".
133133
propsArray.push(Caption({
134134
object: span({}, "more…")

packages/devtools-reps/src/reps/stubs/grip.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ stubs.set("testMoreThanMaxProps", {
7070
"ownPropertyLength": longModeMaxLength + 1,
7171
"preview": {
7272
"kind": "Object",
73-
"ownProperties": Array.from({length: longModeMaxLength + 1})
73+
"ownProperties": Array.from({length: longModeMaxLength})
7474
.reduce((res, item, index) => Object.assign(res, {
7575
["p" + index]: {
7676
"configurable": true,

0 commit comments

Comments
 (0)