Skip to content

Conversation

@nineteen88
Copy link
Contributor

@nineteen88 nineteen88 commented Jan 13, 2026

Proposed behaviour

  • update version picker to use the correct property
  • reinstate the environment variable check
  • add full test coverage for the version picker

Current behaviour

  • version picker is currently using a property that does not exist
  • no tests exist currently for version picker

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

@nineteen88 nineteen88 self-assigned this Jan 13, 2026
@nineteen88 nineteen88 marked this pull request as ready for review January 13, 2026 16:19
@nineteen88 nineteen88 requested review from a team as code owners January 13, 2026 16:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a critical bug in the version picker component where it was attempting to set a non-existent content property instead of the correct title property. The changes restore the environment variable check to conditionally enable the version picker and add comprehensive test coverage.

Changes:

  • Fixed property reference from content to title in the version picker's item formatting logic
  • Reinstated environment variable check (USE_VERSION_PICKER) to conditionally register the version picker addon
  • Added comprehensive test suite covering success states, error handling, URL parameters, and fallback scenarios

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.storybook/version-picker/index.tsx Corrected the property name from content to title when appending "(latest)" label and updated TypeScript types
.storybook/manager.ts Added environment variable check to conditionally register the version picker addon
.storybook/version-picker/version-picker.test.tsx Added comprehensive test coverage including success states, error handling, HTTP failures, and URL parameter parsing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

.sort((a, b) => compareBuild(b.id, a.id));

formattedVersions[0].content = `${formattedVersions[0].content} (latest)`;
formattedVersions[0].title = `${formattedVersions[0].title} (latest)`;
Copy link
Contributor

Choose a reason for hiding this comment

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

non-blocking

Suggested change
formattedVersions[0].title = `${formattedVersions[0].title} (latest)`;
formattedVersions[0].title += " (latest)";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants