Skip to content

Web Lab 2 network tab part 1#70790

Open
molly-moen wants to merge 18 commits intostagingfrom
molly/network-tab
Open

Web Lab 2 network tab part 1#70790
molly-moen wants to merge 18 commits intostagingfrom
molly/network-tab

Conversation

@molly-moen
Copy link
Contributor

@molly-moen molly-moen commented Feb 13, 2026

This adds the initial implementation of the Web Lab 2 network tab. It is currently behind an experiment flag, weblab2-show-debug, so I can iterate on it before releasing it widely. See follow-up work for what is not included in this PR from the mocks.

Screenshots/Screen recording

Full page with panel with successful request

Screenshot 2026-02-13 at 9 51 54 AM

Failed response due to non-allowed url

Screenshot 2026-02-13 at 9 52 10 AM

Response failed on server

Screenshot 2026-02-13 at 9 52 23 AM

Currently placeholder for no requests

Screenshot 2026-02-13 at 9 53 16 AM

Screen recording

Screen.Recording.2026-02-13.at.9.53.26.AM.mov

Links

Testing story

Tested locally. This is behind a flag so there's minimal risk.

Follow-up work

Here is what is not yet included:

  • Panel resizing
  • Open/close panel with button in preview header
  • Close button on panel
  • "No requests" UI
  • Better scrolling of response data
  • Json format response data if it is json
  • Animation of requests in progress (stretch goal)

PR Creation Checklist:

  • Tests provide adequate coverage
  • Privacy impacts have been documented
  • Security impacts have been documented
  • Code is well-commented
  • New features are translatable or updates will not break translations
  • Relevant documentation has been added or updated
  • User impact is well-understood and desirable
  • Follow-up work items (including potential tech debt) are tracked and linked

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds the network tab debugging panel to Web Lab 2, allowing students to inspect network requests made by their HTML projects.

Changes:

  • Added a debug panel component displaying network request/response information
  • Integrated panel into the vertical layout below the preview area
  • Added support for clearing network requests on preview refresh/reload

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
apps/src/weblab2/layout/vertical-layout.module.scss Added styling for debug panel container with fixed height
apps/src/weblab2/layout/VerticalLayout.tsx Integrated DebugPanel component into layout
apps/src/weblab2/htmlPreview/HTMLPreview.tsx Added clearRequests dispatch calls on refresh/reload
apps/src/weblab2/debugPanel/*.module.scss Styling for debug panel components
apps/src/weblab2/debugPanel/images/*.svg Visual indicators for request/response states
apps/src/weblab2/debugPanel/DebugPanel.tsx Main debug panel component with request selection and details
apps/src/weblab2/debugPanel/DetailsBox.tsx Component for displaying request/response details
apps/src/weblab2/debugPanel/NetworkRequestChip.tsx Selectable chip component for each network request

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@molly-moen molly-moen marked this pull request as ready for review February 13, 2026 18:25
@molly-moen molly-moen requested a review from a team February 13, 2026 18:25
Copy link
Contributor

@fisher-alice fisher-alice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Didn't realized how involved this debug panel was!
Left small non-blocking questions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to put these in apps/static?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion. They are super tiny files because they are svgs, and we have other image files in the codebridge folder alongside the code.

};

const requestSuccess = useMemo(() => {
if (selectedRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just confirming that whether the api is in the allowlist or not will be the only determinant of a request success/failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think so. It will be if it failed due to the content security policy, which should generally be because it was not in the allow-list. If the url doesn't exist it would also fail here, because that non-existent url is not in the allow-list.
Other csp failures will end up here too, I'm not sure what else might get caught here. I'm starting with a generic message about the allow-list and we can get more complicated if we need to!

value: selectedRequest?.response?.status,
},
{
label: 'Time',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see 'Request Time' vs 'Time', so I wonder if maybe using 'Duration' or 'Elapsed Time' instead of 'Time' would be more clear? Question for @moshebaricdo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's discuss as a potential follow-up. This was the text from the mock.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "duration" makes more sense here / is more descriptive

if (selectedRequest?.request.cspDirectiveViolated) {
let requestDomain = selectedRequest.request.url;
try {
const url = new URL(selectedRequest.request.url);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think other possible request errors (network/dns failures, timeout, ...) will not be displayed as request errors and treated as response errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep

<div>No network requests</div>
) : (
<div className={moduleStyles.debugPanelContainer}>
<div className={moduleStyles.networkSummary}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: subcomponent for NetworkSummary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might look at this as a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants