Skip to content

fix: guard against null icon_info in dataset navigation#36580

Closed
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:fix/dataset-icon-info-null-crash
Closed

fix: guard against null icon_info in dataset navigation#36580
EvanYao826 wants to merge 1 commit into
langgenius:mainfrom
EvanYao826:fix/dataset-icon-info-null-crash

Conversation

@EvanYao826
Copy link
Copy Markdown
Contributor

Problem

The DatasetNav component on the /apps page accesses dataset.icon_info.icon (and .icon_type, .icon_background, .icon_url) without null guards. When a dataset has icon_info set to null (which the API can return despite the TypeScript type declaring it non-optional), the page crashes with:

TypeError: Cannot read properties of null (reading 'icon')

Fix

  • Add optional chaining (?.) with sensible defaults at both access sites (curNav and navigationItems in dataset-nav/index.tsx)
  • Update the DataSet type in models/datasets.ts to allow null for icon_info

This matches the pattern already used in knowledge-retrieval/node.tsx which correctly handles null icon_info with a fallback.

Fixes #36574

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
@EvanYao826 EvanYao826 requested a review from iamjoel as a code owner May 24, 2026 12:42
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label May 24, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 24, 2026
@crazywoola
Copy link
Copy Markdown
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!

@crazywoola crazywoola closed this Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Apps page crashes when dataset icon metadata is missing

2 participants