fix(repository): prevent test case edit crash from null dropdown option colors#455
Merged
Merged
Conversation
…on colors Dropdown and Multi-Select field options can legitimately have no icon color (iconColorId is nullable). The repository case page's edit-mode renderer read the option's icon/iconColor unguarded, so a single null-colored option threw during render. With no error boundary anywhere, the whole page fell back to the opaque "couldn't load" screen. - Guard icon/iconColor access in the edit-mode option renders of FieldValueRenderer, matching the existing view-mode pattern - Default new option colors to the darkest black instead of leaving them null, mirroring the existing icon default in FieldIconPicker - Add an error boundary so a render exception shows a recoverable message instead of an opaque failure
Contributor
Author
|
🎉 This PR is included in version 0.39.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Opening a repository test case in edit mode crashed to the opaque "this page couldn't load" screen when any of the case's Dropdown / Multi-Select field options had no icon color.
FieldOptions.iconColorIdis nullable, so an option can legitimately haveiconColor == null. The view-mode renderer guards this with optional chaining, but the edit-mode option renderers readoption.fieldOption.iconColor.value(andicon.name) unguarded — so a single null-colored option threw during render. With no error boundary anywhere in the app, Next.js fell back to its default error page. The case viewed and bulk-edited fine; only inline edit crashed, which is why it was hard to reproduce.This PR fixes the crash, prevents the bad data going forward, and adds a recovery boundary:
icon/iconColor, matching the existing view-mode pattern.null, mirroring the existing icon default in the field icon picker. (Editing and saving an existing option that already has a null color also heals it.)Related Issue
N/A — reported via customer support.
Type of Change
How Has This Been Tested?
Describe the tests you ran to verify your changes:
Added regression tests for both the crash and the null-color default. Each was verified to fail without the fix (reproducing the exact
TypeError: Cannot read properties of null) and pass with it. Full local suite green viapnpm precommit(9775 passing).Test Configuration:
Checklist
Screenshots (if applicable)
Additional Notes
The component fix is the root-cause fix; the color default prevents new null-colored options; the error boundary is defense-in-depth for this class of otherwise-silent client render crash.