Skip to content

Conversation

@kendallstrautman
Copy link
Contributor

@kendallstrautman kendallstrautman commented Mar 12, 2021

🎟️ Asana Task
πŸ” Preview Link


Description

On certain components, the new theming changes aren't working as expected because they are using an old version of the button component. Enter, dependency wormholes....

See call-to-action for an example. Right now the product prop isn't affecting the button color, if you upgrade the the button package, it works as expected. Also, Button didn't seem to actually be affected by dark or light theme values, so I added back in that classname. LMK if that's not wanted, but note that other components depend on this property.

This PR updates all old react-button versions on dependent components and upgrades their implementation if needed. Friction like this makes me think we need to really nail down our dependency approach within this monorepo...there doesn't seem to be a consistent way they are defined between packages.

Packages Affected

  • button
  • call-to-action
  • callouts
  • casestudy-slider
  • consent-manager
  • content-cta
  • featured-slider
  • hero
  • logo-grid
  • product-downloader
  • text-split
  • subnav

Release Information

Please select one (required)

  • Major (This PR introduces a breaking (incompatible API) change)
  • Minor (This PR adds functionality but it backwards-compatible)
  • Patch (This PR adds a backwards-compatible bug fix)
Release Notes (required)

PR Checklist πŸš€

Items in this checklist may not may not apply to your PR, but please consider each item carefully.

  • Add Asana and Preview links above.
  • Conduct thorough self-review.
  • Add or update tests as appropriate.
  • Write a useful description (above) to give reviewers appropriate context.
  • Add release notes to the appropriate section (above).
  • Conduct reasonable cross browser testing for both compatibility and responsive behavior (We have a Cross Browser Testing account for this, if you don't have access, just ask!).
  • Conduct reasonable accessibility review (use the WAS as a guide or an axe browser plugin until we establish more formal checks).
  • Identify (in the description above) and document (add Asana tasks on this board) any technical debt that you're aware of, but are not addressing as part of this PR.

@vercel
Copy link

vercel bot commented Mar 12, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

πŸ” Inspect: https://vercel.com/hashicorp/react-components/BSxuwN1QLwSnj7dT4GEARw5929PG
βœ… Preview: https://react-components-git-ksupdate-btn-deps-hashicorp.vercel.app

`variant-${themeObj.variant}`,
themeClass,
{ 'brand-neutral': themeObj.brand === 'neutral' },
`background-${themeObj.background}`,
Copy link
Contributor Author

@kendallstrautman kendallstrautman Mar 12, 2021

Choose a reason for hiding this comment

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

Button didn't seem to actually be affected by dark or light theme values, so I added back in that classname. LMK if that's not wanted, but note that other components depend on this property.

}
return (
<div className={`g-call-to-action variant-${variant} theme-${theme}}`}>
<div className={`g-call-to-action variant-${variant} theme-${theme}`}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix: as the classname wasn't dark} 🀭

"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@hashicorp/react-button": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wonder why the updated version of @hashicorp/react-button isn't in the lock file.... πŸ€”

Copy link
Contributor

Choose a reason for hiding this comment

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

I think you hit the nail on the head in the comment below - lerna bootstrap modifies package-lock files when it finds and symlinks interdependencies within the monorepo (at least, that's my understanding πŸ˜… )

"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@hashicorp/react-inline-svg/-/react-inline-svg-1.0.2.tgz",
"integrity": "sha512-AAFnBslSTgnEr++dTbMn3sybAqvn7myIj88ijGigF6u11eSRiV64zqEcyYLQKWTV6dF4AvYoxiYC6GSOgiM0Yw=="
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know why this was removed...maybe someone didn't run bootstrap after removing that dep?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, this seems accurate! We're tracking when this bites us on the platform board - ideally we'd have a CI check to catch these before they get merged.

Copy link
Contributor

@zchsh zchsh Mar 12, 2021

Choose a reason for hiding this comment

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

Err wait to clarify - I think this would have happened if someone didn't run bootstrap after adding the dep. I know I've forgotten to do that a few times πŸ˜…

],
"dependencies": {
"@hashicorp/react-button": "^2.2.4"
"@hashicorp/react-button": "^4.1.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are we going to have to update all of these again when we release the breaking change with colors??... I felt like this was something Lerna would take care of, but I guess not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sort of like, should this just be a peer dep??

Copy link
Contributor

@zchsh zchsh Mar 12, 2021

Choose a reason for hiding this comment

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

I think Lerna should take care of this - I made the mistake of manually bumping versions in recent docs-page work, but as long as there's none of that happening, and as long as the version numbers actually match (as they do in this case thanks to all the work you did πŸ˜… ), I think lerna should do its job.

I don't have a super deep understanding of peer deps vs direct ones, but based on my understanding so far button should be a direct dependency, since we need a specific version of button code to run callouts (rather than callouts just being "compatible" or "intended for use with" a specific version of button).

</a>
</div>
<div className="feature-content g-type-body">
<div
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The dark and light theme was broken on this component.


& .slider-frame {
& .case-study {
& .dark {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Text wasn't showing on dark.

title={`${c.name} Website`}
url={c.link}
theme="dark-outline"
theme={{ variant: 'secondary' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updates to new API

@kendallstrautman kendallstrautman marked this pull request as ready for review March 12, 2021 19:16
Copy link
Contributor

@zchsh zchsh left a comment

Choose a reason for hiding this comment

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

βœ… Thanks for tackling all the dependency weirdness πŸ’― πŸŽ‰

Took a look at the preview and the dark theme fix on case-study-slider & the logo-grid theme format update both look great πŸ™Œ

"version": "1.0.2",
"resolved": "https://registry.npmjs.org/@hashicorp/react-inline-svg/-/react-inline-svg-1.0.2.tgz",
"integrity": "sha512-AAFnBslSTgnEr++dTbMn3sybAqvn7myIj88ijGigF6u11eSRiV64zqEcyYLQKWTV6dF4AvYoxiYC6GSOgiM0Yw=="
},
Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, this seems accurate! We're tracking when this bites us on the platform board - ideally we'd have a CI check to catch these before they get merged.

"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@hashicorp/react-button": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you hit the nail on the head in the comment below - lerna bootstrap modifies package-lock files when it finds and symlinks interdependencies within the monorepo (at least, that's my understanding πŸ˜… )

],
"dependencies": {
"@hashicorp/react-button": "^2.2.4"
"@hashicorp/react-button": "^4.1.0"
Copy link
Contributor

@zchsh zchsh Mar 12, 2021

Choose a reason for hiding this comment

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

I think Lerna should take care of this - I made the mistake of manually bumping versions in recent docs-page work, but as long as there's none of that happening, and as long as the version numbers actually match (as they do in this case thanks to all the work you did πŸ˜… ), I think lerna should do its job.

I don't have a super deep understanding of peer deps vs direct ones, but based on my understanding so far button should be a direct dependency, since we need a specific version of button code to run callouts (rather than callouts just being "compatible" or "intended for use with" a specific version of button).

@kendallstrautman
Copy link
Contributor Author

We're going to ask the Lerna folks about this behavior to get more clarity as to what went wrong here. I'll connect this issue there.

Copy link
Contributor

@jescalan jescalan left a comment

Choose a reason for hiding this comment

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

Edit: never mind kendall just posted the same thing above!

@kendallstrautman kendallstrautman marked this pull request as draft March 12, 2021 21:07
@kendallstrautman
Copy link
Contributor Author

See the issue, feel free to add more comments or questions! It's kind of an odd one to explain so feel free to chime in.

@kendallstrautman
Copy link
Contributor Author

Thinking outloud: I suppose this PR doesn't necessarily need to go with the branding refresh PR, we could merge and release this separately as a patch once we figure out the dependency stuff.

@kendallstrautman
Copy link
Contributor Author

@jescalan Now that I am actually updating the colors, the legacy button styles are going to get in the way of Visual QA. We may need to review / merge this before we hear back from Lerna or find out exactly what happened.

@jescalan
Copy link
Contributor

@kendallstrautman I think that's ok, let's move forward with it then!

@kendallstrautman kendallstrautman marked this pull request as ready for review March 16, 2021 18:37
@kendallstrautman
Copy link
Contributor Author

Cool, I rebased onto the branding assembly. For me, its easier to do one release for the packages with the color updates and this dep stuff, but let me know if we want to merge this into main and release sooner

@mwickett
Copy link
Contributor

Because the rollout process is kind of a pain, I vote we avoid doing it twice.

@jescalan
Copy link
Contributor

Agreed, let's take that approach πŸ‘πŸΌ

@kendallstrautman kendallstrautman merged commit 3442622 into ks.assembly-branding-refresh Mar 17, 2021
@kendallstrautman kendallstrautman deleted the ks.update-btn-deps branch March 17, 2021 17:36
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.

4 participants