Closed Bug 1314571 Opened 8 years ago Closed 8 years ago

Use Reps in "long" mode in the new console frontend

Categories

(DevTools :: Console, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1314573

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

We are using Reps in the console, but without specifying any mode, which in the majority of the Reps fall back to "short" mode. 
Since we want to preview more than 3 items for object, array, .. we should specify to use the "long" mode.
Assignee: nobody → chevobbe.nicolas
Depends on: 1314573
I'm guessing this is because of compat with old console. However, Chrome does use what's basically short mode (theirs stops at 5 IIRC). Plus, the more we display, the worse performance is going to get since reps are heavy.

I'd say lets keep it as it is, but am open to discussion.
You are right, this is mainly for compatibility with the old console, and more specifically, Patrick think that it is important to have array of nodes (or NodeList) preview the first 10 items ( see https://bugzilla.mozilla.org/show_bug.cgi?id=1307938#c8 ).
From a user perspective, I think that displaying as much information as we could is better, since it doesn't require any user interaction to actually see what they wants.

From a pref perspective, I guess it would be slower since we would mount 3 times more component. Would this be tampered by the move from components to simple functions in Reps we talked about Monday ?

Maybe we could be smart and only apply the "long" mode for NodeList or array of nodes, even if I tend to think we should display a consistent number of first items ? 

FWIW, I just entered $$("p") in the Chrome console on https://www.mozilla.org/en-US/firefox/new/?oldversion=51.0a1, and it displays even more than 10 items. From quick tests, it looks like they go up to 50 items, and then show a collapsed "▶Array[51]"
(In reply to Lin Clark [:linclark] from comment #1)
> I'm guessing this is because of compat with old console.
Yes

> However, Chrome
> does use what's basically short mode (theirs stops at 5 IIRC). Plus, the
> more we display, the worse performance is going to get since reps are heavy.

I tried to execute `[...document.querySelectorAll('span')]` in Chrome Console panel (google.com) and I am seeing long array of all span elements (seems not limited). Not sure what the limit is, but it's definitely bigger than 5

> I'd say lets keep it as it is, but am open to discussion.

I had similar comment here:
https://bugzilla.mozilla.org/show_bug.cgi?id=1307938#c20


Brief summary, how about:
- 0 (or ignored anyway) in tiny mode (e.g. rendering array items or object props)
- 3 in short mode (e.g. side panels)
- 10 in long mode (to keep back comp, or make it bigger if no perf issues) e.g. Console panel

(In reply to Nicolas Chevobbe [:nchevobbe] from comment #2)
> You are right, this is mainly for compatibility with the old console, and
> more specifically, Patrick think that it is important to have array of nodes
> (or NodeList) preview the first 10 items ( see
> https://bugzilla.mozilla.org/show_bug.cgi?id=1307938#c8 ).
> From a user perspective, I think that displaying as much information as we
> could is better, since it doesn't require any user interaction to actually
> see what they wants.
Yes, agree

> From a pref perspective, I guess it would be slower since we would mount 3
> times more component. Would this be tampered by the move from components to
> simple functions in Reps we talked about Monday ?
My feeling is yes, but I'll let Lin to confirm.

> Maybe we could be smart and only apply the "long" mode for NodeList or array
> of nodes, even if I tend to think we should display a consistent number of
> first items ?
If moving to simple functions helps, I'd vote for consistency.
 
> 
> FWIW, I just entered $$("p") in the Chrome console on
> https://www.mozilla.org/en-US/firefox/new/?oldversion=51.0a1, and it
> displays even more than 10 items. From quick tests, it looks like they go up
> to 50 items, and then show a collapsed "▶Array[51]"
Yep, just made similar test (see above)

Honza
Ah, interesting. They have a different number for Objects. The following will cut off `f`.

> console.log({a:1, b:2, c:3, d:4, e:5, f:6})

If others feel strongly about this, then I'm ok with it. In that case, I would like to see long mode changed to 10 items to minimize the perf issue.

> From a pref perspective, I guess it would be slower since we would mount 3 times more component. Would this be tampered by the move from components to simple functions in Reps we talked about Monday ?

Unfortunately, the change that I proposed to Reps doesn't get us all the way there. Reps will still be heavier than doing the same thing with straight DOM manipulation, and will still have a noticeable impact on first scroll if enough visible log messages contain heavy Reps.
Priority: -- → P2
Status: NEW → ASSIGNED
No longer depends on: 1314573
Closing this as dupe as Bug 1314573 since it makes sense to have all changes there
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.