Skip to content

Fix errors caused by immutable.js v4 to v5 upgrade#2458

Merged
rfontanarosa merged 8 commits intomasterfrom
rfontanarosa/hotfix-immutable5
Mar 19, 2026
Merged

Fix errors caused by immutable.js v4 to v5 upgrade#2458
rfontanarosa merged 8 commits intomasterfrom
rfontanarosa/hotfix-immutable5

Conversation

@rfontanarosa
Copy link
Collaborator

No description provided.

@rfontanarosa rfontanarosa self-assigned this Mar 17, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 addresses breaking changes introduced by an upgrade of the immutable.js library from version 4 to 5. The changes primarily involve adapting the codebase to stricter type definitions and potential undefined returns from collection methods like first(), as well as resolving type inference issues with Map constructions to maintain application stability.

Highlights

  • Immutable.js first() method updates: Updated calls to immutable.js's first() method to explicitly handle potential undefined returns, either by using non-null assertions (!) or nullish coalescing (?? '') to ensure type safety and correct behavior.
  • Type assertion adjustments for Map and first() results: Adjusted type assertions for immutable.js Map creations and first() results using as unknown as to resolve type compatibility issues that arose after the library upgrade.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • web/src/app/components/create-survey/create-survey.component.ts
    • Added a non-null assertion to the first() method call on survey.jobs.
  • web/src/app/components/main-page-container/main-page/drawing-tools/drawing-tools.component.ts
    • Applied nullish coalescing to the first() method call on survey.jobs.keySeq() to provide a default empty string.
  • web/src/app/components/main-page-container/main-page/side-panel/submission-form/submission-form.component.ts
    • Introduced an as unknown as type assertion for the result of values.first() to correctly cast it to Option.
  • web/src/app/converters/loi-data-converter.ts
    • Added an as unknown as type assertion to the Map(properties) return value to specify its type as Map<string, string | number>.
  • web/src/app/converters/submission-data-converter.ts
    • Applied an as unknown as type assertion to the Map(submissionData) return value to correctly cast it to SubmissionData.
  • web/src/app/models/loi.model.ts
    • Added a non-null assertion to the first() method call within the get smallestLoi() getter.
Activity
  • No human activity has been recorded on this pull request yet.
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 addresses breaking changes from the immutable.js v4 to v5 upgrade. Most changes correctly adapt to the new, stricter typings by adding non-null assertions, nullish coalescing, or type casting. I've found a couple of places where the fix could be improved to prevent potential runtime errors. One change incorrectly casts a string to an object, which will not work as intended. Another change uses a non-null assertion that could cause a crash if an empty list is provided. My comments provide suggestions to make the code more robust.

@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 33.33333% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.92%. Comparing base (3227a7b) to head (f4a5c8d).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
...omponents/create-survey/create-survey.component.ts 0.00% 5 Missing ⚠️
...panel/submission-form/submission-form.component.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2458      +/-   ##
==========================================
- Coverage   58.97%   58.92%   -0.05%     
==========================================
  Files         111      111              
  Lines        2747     2761      +14     
  Branches      408      413       +5     
==========================================
+ Hits         1620     1627       +7     
- Misses       1065     1072       +7     
  Partials       62       62              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rfontanarosa rfontanarosa requested review from gino-m March 17, 2026 14:49
Copy link
Collaborator

@gino-m gino-m left a comment

Choose a reason for hiding this comment

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

Please also add test cases to reproduce the regression and to ensure it stays fixed.

@rfontanarosa
Copy link
Collaborator Author

Please also add test cases to reproduce the regression and to ensure it stays fixed.

but it was not a regression but a different immutable signature for first(). now it should be compatible with version 4 and 5.

@rfontanarosa rfontanarosa requested a review from gino-m March 18, 2026 19:54
@rfontanarosa rfontanarosa merged commit 79c3338 into master Mar 19, 2026
9 checks passed
@rfontanarosa rfontanarosa deleted the rfontanarosa/hotfix-immutable5 branch March 19, 2026 13:17
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