Skip to content

Conversation

@rak-phillip
Copy link
Member

@rak-phillip rak-phillip commented Dec 23, 2025

Summary

This resolves a console error by removing the bg- prefix from the state background.

Fixes #16267

Occurred changes and/or fixed issues

Remove bg- prefix from the state background

Technical notes summary

It appears that the stateBackground is prefixed with a bg-

get stateBackground() {
return this.stateColor.replace('text-', 'bg-');
}

While the status indicator expects no prefix:

export const StatusDefinitions = {
info: {
primary: '--rc-info',
secondary: '--rc-info-secondary'
},
success: {
primary: '--rc-success',
secondary: '--rc-success-secondary'
},
warning: {
primary: '--rc-warning',
secondary: '--rc-warning-secondary'
},
error: {
primary: '--rc-error',
secondary: '--rc-error-secondary'
},
unknown: {
primary: '--rc-unknown',
secondary: '--rc-unknown-secondary'
},
none: {
primary: '--rc-none',
secondary: '--rc-none-secondary'
},
};

Areas or cases that should be tested

See issue - there should be no error printed to the browser console when navigating to a deployment detail page. The status indicator should be correct.

Areas which could experience regressions

Any valid status that contains bg- will have the matching string stripped.

Screenshot/Video

Image

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

Copy link
Member

@eva-vashkevich eva-vashkevich left a comment

Choose a reason for hiding this comment

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

I've noticed we use bg- in quite a few places in the code. Would it make more sense to rename statusDefinitions instead to avoid this happening in the future as we migrate more components?

@rak-phillip
Copy link
Member Author

I've noticed we use bg- in quite a few places in the code. Would it make more sense to rename statusDefinitions instead to avoid this happening in the future as we migrate more components?

That's a good point. I'll defer to @codyrancher to see if he has any feedback on if we want to modify statusDefinitions, as he was the original author.

@codyrancher
Copy link
Member

I'm not a big fan of adding the 'bg' prefix to the StatusDefinitions.

I see how it would make migrating easier but I'd prefer to make the new components as free from our legacy cruft as we can. I don't think it makes sense for a status definition to have any mention of background.

One alternative is to use the stateSimpleColor which should help bridge the gap from the old to the new.

@rak-phillip
Copy link
Member Author

@eva-vashkevich @codyrancher this has been updated to utilize stateSimpleColor and is ready for another review.

@rak-phillip rak-phillip merged commit 97abb8a into rancher:master Jan 8, 2026
63 of 64 checks passed
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.

Console Error: TypeError: can't access property "primary", statusColors.value is undefined

3 participants