Skip to content

fix: update treemap when chunk selection changes#722

Open
christiango wants to merge 4 commits into
webpack:mainfrom
christiango:christiango-fix-chunk-selection-treemap
Open

fix: update treemap when chunk selection changes#722
christiango wants to merge 4 commits into
webpack:mainfrom
christiango:christiango-fix-chunk-selection-treemap

Conversation

@christiango

Copy link
Copy Markdown

Summary

  • update ModulesTreemap.handleSelectedChunksChange to call store.setSelectedChunks
  • add a browser-level regression test using a generated multi-chunk static report
  • add a patch changeset

Root cause

Commit 77599a400605587eb4c27d946a1830060cad7c96 moved direct MobX state assignments behind action methods. During that refactor, the chunk-selection handler was changed from assigning store.selectedChunks to calling store.setSelectedSize(selectedChunks) instead of store.setSelectedChunks(selectedChunks).

CheckboxList therefore updated its local checkbox state, but the selected chunks in the store remained unchanged. The treemap continued receiving the original chunks rather than a data set filtered to the current checkbox selection.

The nearby handlers introduced in the same commit were reviewed: size selection uses setSelectedSize, search uses setSearchQuery, and entrypoint/context-menu chunk filtering uses setSelectedChunks correctly.

Regression test

The new Puppeteer test generates a static report containing multiple chunks, opens it in the browser, deselects a real chunk checkbox, and verifies both that the checkbox is unchecked and that the deselected chunk is absent from the data passed to Treemap. This test fails with the incorrect setSelectedSize(selectedChunks) call and passes with setSelectedChunks(selectedChunks).

Validation

  • npm run lint
  • npm run build
  • npm test — 8 suites passed, 129 tests passed, 4 skipped
  • manually generated a multi-chunk static report and confirmed deselection updates the checkbox, clears the “All” checkbox, removes the chunk from treemap data, and selecting all restores the original treemap data

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 87c6b51

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
webpack-bundle-analyzer Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@linux-foundation-easycla

linux-foundation-easycla Bot commented Jul 10, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: christiango / name: Christian Gonzalez (10d178b)

@christiango christiango force-pushed the christiango-fix-chunk-selection-treemap branch from 72117ed to 9feec7a Compare July 10, 2026 18:05
@christiango christiango force-pushed the christiango-fix-chunk-selection-treemap branch from 9feec7a to 10d178b Compare July 10, 2026 18:09
@christiango christiango marked this pull request as ready for review July 10, 2026 18:12
Copilot AI review requested due to automatic review settings July 10, 2026 18:12

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes a regression in the client UI where changing chunk checkbox selections did not update the treemap because the chunk-selection handler called the wrong store action. Adds a browser-level regression test to validate the treemap’s data updates when a chunk is deselected, and includes a patch changeset.

Changes:

  • Fix ModulesTreemap.handleSelectedChunksChange to call store.setSelectedChunks(selectedChunks).
  • Add a Puppeteer regression test that deselects a chunk and asserts the treemap data no longer includes it.
  • Add a patch changeset entry documenting the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
client/components/ModulesTreemap.jsx Corrects the chunk-selection handler to update selectedChunks (not size).
test/analyzer.js Adds a Puppeteer regression test for treemap updates on chunk deselection.
.changeset/fix-chunk-selection.md Publishes a patch changeset describing the regression fix.

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

Comment thread test/analyzer.js Outdated
Comment thread test/analyzer.js Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 19:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread test/analyzer.js Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Comment thread client/viewer.jsx Outdated
Copilot AI review requested due to automatic review settings July 10, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

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.

2 participants