fix: guard against null icon_info in dataset navigation#36580
Closed
EvanYao826 wants to merge 1 commit into
Closed
fix: guard against null icon_info in dataset navigation#36580EvanYao826 wants to merge 1 commit into
EvanYao826 wants to merge 1 commit into
Conversation
The DatasetNav component accesses dataset.icon_info.icon (and .icon_type, .icon_background, .icon_url) without null guards. When a dataset has icon_info set to null, the page crashes with TypeError: Cannot read properties of null (reading 'icon'). Add optional chaining with sensible defaults at both access sites and update the DataSet type to allow null icon_info. Fixes langgenius#36574
6 tasks
Member
|
Hi @EvanYao826, thank you for your contribution. This issue already has an earlier linked PR (#36578), and according to our FIFO standard we proceed with the first PR for an issue. I am closing this PR to keep the review queue focused. We appreciate your work and hope you will continue contributing. Thanks! |
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.
Problem
The
DatasetNavcomponent on the/appspage accessesdataset.icon_info.icon(and.icon_type,.icon_background,.icon_url) without null guards. When a dataset hasicon_infoset tonull(which the API can return despite the TypeScript type declaring it non-optional), the page crashes with:Fix
?.) with sensible defaults at both access sites (curNavandnavigationItemsindataset-nav/index.tsx)DataSettype inmodels/datasets.tsto allownullforicon_infoThis matches the pattern already used in
knowledge-retrieval/node.tsxwhich correctly handles nullicon_infowith a fallback.Fixes #36574