Skip to content

[NO-JIRA][BpkRating] Fixed the issue where some BpkRating attributes were required #3885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

Faye-Xiao
Copy link
Contributor

@Faye-Xiao Faye-Xiao commented Jul 16, 2025

The BpkRating only has two required props. However, the previous changes(#2184 and #3872) made two props required by mistake. This PR is to fix this issue.
Props explanation: https://backpack.github.io/storybook/iframe.html?args=&id=bpk-component-rating--documentation&viewMode=docs
Screenshot 2025-07-16 at 19 17 10

Remember to include the following changes:

  • Ensure the PR title includes the name of the component you are changing so it's clear in the release notes for consumers of the changes in the version e.g [Clover-123][BpkButton] Updating the colour
  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Accessibility tests
    • The following checks were performed:
      • Ability to navigate using a keyboard only
      • Zoom functionality (Deque University explanation):
        • The page SHOULD be functional AND readable when only the text is magnified to 200% of its initial size
        • Pages must reflow as zoom increases up to 400% so that content continues to be presented in only one column i.e. Content MUST NOT require scrolling in two directions (both vertically and horizontally)
      • Ability to navigate using a screen reader only
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

@Copilot Copilot AI review requested due to automatic review settings July 16, 2025 11:18
@Faye-Xiao Faye-Xiao added the patch Patch production bug label Jul 16, 2025
Copy link
Contributor

@Copilot 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 an issue with the BpkRating component where two props (ratingScale and size) were incorrectly marked as required when they should be optional. The component provides default values for these props, so they don't need to be required in the TypeScript interface.

  • Makes ratingScale and size props optional in the TypeScript interface
  • Removes redundant defaultProps object from tests since defaults are now handled in the component implementation
  • Simplifies test setup by removing the spread of unnecessary default props

Reviewed Changes

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

File Description
packages/bpk-component-rating/src/BpkRating.tsx Updates Props type to make ratingScale and size optional
packages/bpk-component-rating/src/BpkRating-test.tsx Removes defaultProps object and cleans up test props

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3885 to see this build running in a browser.

@skyscanner-backpack-bot
Copy link

skyscanner-backpack-bot bot commented Jul 16, 2025

Warnings
⚠️

Package source files (e.g. packages/package-name/src/Component.js) were updated, but snapshots weren't. Have you checked that the tests still pass?

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 9bbd6e1

showScale?: boolean,
size: ValueOf<typeof RATING_SIZES>,
size?: ValueOf<typeof RATING_SIZES>,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skyscanner-backpack-bot
Copy link

Visit https://backpack.github.io/storybook-prs/3885 to see this build running in a browser.

@Faye-Xiao Faye-Xiao merged commit e55c824 into main Jul 17, 2025
10 checks passed
@Faye-Xiao Faye-Xiao deleted the fix-bpk-rating-prop branch July 17, 2025 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Patch production bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants