Skip to content
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

Hotfix wrong override when value is not defined in breakpoint #6969

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

AntoineDuComptoirDesPharmacies
Copy link
Contributor

What does this PR do?

This PR tend to avoid generating a wrong CSS override when value is not known in theme breakpoint (Same as for gap, etc...)

Where should the reviewer start?

Read the linked issue to see the difference between both Codepens.

What testing has been done on this PR?

Manual tests only

How should this be manually tested?

Use Developper console with the new version to figure out that CSS override have not been generated for unknown value.
Then add a 'small' breakpoint with distinct edgeSize value to see the override being generated.

Do Jest tests follow these best practices?

No Jest tests.

Any background context you want to provide?

What are the relevant issues?

Issue #6968

Screenshots (if appropriate)

N/A

Do the grommet docs need to be updated?

No

Should this PR be mentioned in the release notes?

Maybe, depending if a lot of people get a specific expected behavior with this bug.

Is this change backwards compatible or is it a breaking change?

It should be backwards compatible, except if some users get a specific behavior getting the raw CSS value inserted and being different than the value defined in global theme.

@britt6612
Copy link
Collaborator

@AntoineDuComptoirDesPharmacies can you run yarn jest -u to update the snapshot?

@AntoineDuComptoirDesPharmacies
Copy link
Contributor Author

@AntoineDuComptoirDesPharmacies can you run yarn jest -u to update the snapshot?

Done, thank you for this tip !

@britt6612
Copy link
Collaborator

looking into the jest test now and seeing what going on.. for the bundle size error can you go here and change bundle size to 162 and that at least fixes that one error I while I look into the jest error!

@britt6612
Copy link
Collaborator

@AntoineDuComptoirDesPharmacies I beleive your yarn.lock is not in sync with master if you can git pull upstream master then run yarn and then yarn jest -u it should work. Let me know if you have any issues

@jcfilben
Copy link
Collaborator

You can also try creating a new fresh branch to see if that resolves the snapshot issues

@AntoineDuComptoirDesPharmacies
Copy link
Contributor Author

You can also try creating a new fresh branch to see if that resolves the snapshot issues

Thank you, I revert the commits containing snapshot update and modify the only snapshot who have changed.
We are all good now concerning tests.

const breakpoint =
responsiveBreakpoint && theme.global.breakpoints[responsiveBreakpoint];
const breakpoint = getBreakpointStyle(theme, responsiveBreakpoint);
const metric = theme.global.edgeSize[data] || data;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Behavior looks great. Two small naming suggestions would be to align the variable names with the concept of CSS value. Metric was a little bit confusing at first:

  • metric --> value
  • responsiveMetric --> responsiveValue

soft opinion.

@@ -579,12 +579,6 @@ exports[`Tip themed 1`] = `
animation-delay: 0.01s;
}

@media only screen and (max-width:768px) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm trying to understand why this margin goes away with these changes. Can you explain?

@britt6612 britt6612 added the waiting Awaiting response to latest comments label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting Awaiting response to latest comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants