Skip to content

Conversation

@shixiao-coder
Copy link
Contributor

This change modifies the package.json and package-lock.json files to reflect the updated versions.

This change also modifies javascript code to be compatible with d3 v7. Main d3 changes from v5 to v7 include:

Removal of d3.event (https://observablehq.com/@d3/d3v6-migration-guide) Removal of d3.mouse and use d3.pointer instead

…encies.

This change modifies the package.json and package-lock.json files to reflect the updated versions.

This change also modifies javascript code to be compatible with d3 v7. Main d3 changes from v5 to v7 include:

Removal of d3.event (https://observablehq.com/@d3/d3v6-migration-guide)
Removal of d3.mouse and use d3.pointer instead
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shixiao-coder, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a critical technical upgrade, migrating the D3.js charting library from version 5 to version 7. This update necessitates broad changes across the codebase to adapt to D3's revised event handling mechanisms and API. Concurrently, the TypeScript environment has been modernized with an upgrade to the latest compiler version and updated D3 type definitions, ensuring continued type safety and compatibility with the new library version. The overall impact is a more current and maintainable charting infrastructure.

Highlights

  • D3.js Upgrade: The D3.js library has been upgraded from version 5 to version 7, requiring significant changes to event handling and API usage across multiple charting components.
  • Event Handling Migration: Code relying on d3.event for mouse and drag events has been updated to pass the event object explicitly, and d3.mouse has been replaced with d3.pointer to align with D3 v7 API changes.
  • TypeScript and Dependency Updates: The TypeScript compiler has been updated to version 5.9.3, and the @types/d3 package has been updated to match D3 v7. The tsconfig.json target has also been updated to es2021.
  • Type Safety Improvements: Explicit type annotations have been added to various callback functions and data mappings, enhancing type safety and code clarity, especially in chart-related utilities.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully updates d3 from v5 to v7, addressing breaking changes like the removal of d3.event and d3.mouse. The changes are generally correct and follow the migration guide. My review focuses on improving type safety by replacing the widespread use of any for event handlers with more specific types like MouseEvent, PointerEvent, or d3.D3ZoomEvent. This will enhance code maintainability and catch potential bugs. I've also identified a potential issue with handling an undefined dataset value that could lead to runtime errors.

juliawu added a commit that referenced this pull request Dec 12, 2025
As part of #5835 , the target in tsconfig.json needs to be upgraded from
es6 to es2021. This PR isolates the es2021 change.

The main difference appears to be how dynamic imports are treated. This
PR:
* Updates the module in tsconfig.json to "esnext" instead of "commonJS".
This allows webpack to correctly use `import()` as we have across the
codebase
* Updates the handling of dynamic imports (primarily in
`loadLocaleData()`) to be es2021 compatible
* Includes some trailing lint fixes to get pre-merge tests to pass

---------

Co-authored-by: Xiao Shi <shixiao@google.com>
Copy link
Contributor

@dwnoble dwnoble left a comment

Choose a reason for hiding this comment

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

Thanks @shixiao-coder ! i tested the various web components, the /explore search results, and the /disasters pages locally and everything worked for me

@beets
Copy link
Collaborator

beets commented Dec 17, 2025

thanks xiao! would be worth running this through the screenshot suite -- @gmechali can help point you to instructions on how to do that for a local change.

separately, would be great to hold off on merging this until after the later part of this week

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