Skip to content

fix: external datasets are dropped from the atlas datasets tab when it has no hca datasets (#3236) - #3241

Merged
frano-m merged 2 commits into
mainfrom
fran/3236-external-datasets-guard
Oct 5, 2026
Merged

frano-m merged 2 commits into
mainfrom
fran/3236-external-datasets-guard

Conversation

@frano-m

@frano-m frano-m commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #3236

In getContentStaticProps, the append of atlas.externalDatasets lived inside the if (atlas.datasets.length > 0) guard, so an atlas with only external datasets rendered an empty datasets tab.

The guard now gates only the Azul fetch, which has moved into a fetchAtlasProjects helper. That helper returns [] early when the atlas has no HCA datasets, and a comment explains why the guard has to stay: filterProjectId([]) would send an empty filter that Azul doesn't define. External datasets are always merged. The merged list is sorted by title, ignoring case, the same as on main, where the old if (datasets) check on the always-present array was always true. So the order of HCA-only atlases doesn't change.

The Azul and CELLxGENE fetches now run in parallel.

Verification

  • Lint, tsc --noEmit, prettier and npm run build-prod:data-portal pass.
  • Probe: with the eye retina atlas's HCA datasets temporarily emptied, the built datasets.html listed the external dataset and no HCA project. Config restored afterwards.
  • Normal build: the mixed eye retina atlas shows both HCA and external datasets.

Notes from review

🤖 Generated with Claude Code

@frano-m
frano-m force-pushed the fran/3236-external-datasets-guard branch from 9245386 to 168ed43 Compare September 24, 2026 04:33
Base automatically changed from fran/3210-path-alias to main September 29, 2026 06:48

@NoopDog NoopDog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm requesting changes mainly because the branch needs a rebase (see eslint.config.mjs). The fix itself is correct: externalDatasets is a required ProjectsResponse[], so the old if (datasets) check isn't needed. Inline comments cover the rest. Two more findings are on lines outside this diff:

  • utils/trackerAtlasPages.ts:87: tracker atlases have the same bug. The tracker path hard-codes projectsResponses: [] and never reads atlas.externalDatasets. A tracker-sourced atlas (breast, gut, liver and others) that gets a non-empty externalDatasets would show "No Source Studies" on its datasets tab, the same symptom #3236 fixes for non-tracker atlases. Merging externalDatasets in one shared place, or ruling it out in the type for tracker atlases, would close both paths.
  • utils/atlasPages.ts: the Overview and Source Datasets pages fetch data they never show. They still go through this builder, so they make the Azul round trips and embed projectsResponses in __NEXT_DATA__ (now including external datasets), but only the Datasets main column reads it. A per-page option like the existing TrackerDataOptions could skip building it on those pages. Lower priority.

No page today is affected by the bug or by the ordering change, because every non-tracker atlas with external datasets also has HCA datasets.

Comment thread eslint.config.mjs
Comment thread utils/atlasPages.ts Outdated
Comment thread utils/atlasPages.ts Outdated
Comment thread utils/atlasPages.ts Outdated
Comment thread utils/atlasPages.ts Outdated
…t has no hca datasets (#3236)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AsKeyxfv4ZT3FdQaqtGBdV
#3236)

move the azul projects fetch into fetchatlasprojects, explain why the empty
datasets guard must stay, drop the unverified azul ordering comment, and use
type imports for type-only symbols.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@frano-m

frano-m commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Replies to the two findings outside the diff:

@frano-m
frano-m marked this pull request as ready for review October 5, 2026 05:39
@frano-m
frano-m requested a balanced review from Copilot October 5, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The focused change satisfies the acceptance criteria without introducing unresolved issues.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes atlas dataset tabs so external-only atlases display their datasets.

Changes:

  • Separates guarded Azul fetching into fetchAtlasProjects.
  • Always merges and sorts external datasets.
  • Runs Azul and CELLxGENE requests concurrently.
File Description
utils/​atlasPages.ts Corrects dataset merging and refactors concurrent fetching.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@frano-m
frano-m merged commit 5059052 into main Oct 5, 2026
2 checks passed
@frano-m
frano-m deleted the fran/3236-external-datasets-guard branch October 5, 2026 05:44
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.

fix: external datasets are dropped from the atlas datasets tab when the atlas has no hca datasets

3 participants