Skip to content

Conversation

@layershifter
Copy link
Member

@layershifter layershifter commented Oct 24, 2022

Fixes #261.
Fixes #230.

This PR modifies:

  • mergeClasses() in Griffel core to emit errors if a call contains multiple occupancies of classes from makeResetStyles.
  • Jest serializer to handle classes from makeResetStyles

Both changes uses new global variable DEBUG_RESET_CLASSES to store classes. This works similarly to DEFINITION_LOOKUP_TABLE, but we need DEBUG_RESET_CLASSES only in development/tests so it has zero impact on production bundles.

@github-actions
Copy link

github-actions bot commented Oct 24, 2022

📊 Bundle size report

Unchanged fixtures
Package & Exports Size (minified/GZIP)
core
makeResetStyles (runtime)
16.832 kB
6.245 kB
core
makeStyles + mergeClasses (build time)
1.842 kB
877 B
core
makeStyles + mergeClasses (runtime)
20.789 kB
7.724 kB
react
__css + mergeClasses (build time)
1.879 kB
874 B
react
__styles + mergeClasses (build time)
3.581 kB
1.614 kB
react
makeResetStyles (runtime)
18.595 kB
6.981 kB
react
makeStaticStyles (runtime)
9.443 kB
4.068 kB
react
makeStyles + mergeClasses (runtime)
22.554 kB
8.436 kB
🤖 This report was generated against f8730b8d21573a94307458c9f313e64178fede94

@layershifter layershifter force-pushed the feat/griffel-validation branch from ba21a5e to a686cfa Compare October 24, 2022 12:33
Comment on lines -4 to -6
/**
* @internal
*/
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, a leftover from the time when it was unstable.

/**
* form parts of regular expression and removes collected classNames from string
* @example
* regex = /r?(f16th3vw|frdkuqy0|fat0sn40|fjseox00)/
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't use r prefix for RTL classes for a long time.

@layershifter layershifter marked this pull request as ready for review October 24, 2022 15:35
@layershifter layershifter requested a review from a team as a code owner October 24, 2022 15:35
@@ -0,0 +1,7 @@
{
"type": "patch",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be a minor ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup

@layershifter layershifter merged commit 5f2b99c into microsoft:main Oct 26, 2022
@layershifter layershifter deleted the feat/griffel-validation branch October 26, 2022 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants