-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
fix: update RTL in ax(), useAx() removal #17713
Conversation
@@ -150,29 +146,4 @@ storiesOf('MakeStyles', module) | |||
<Container primary>Hello world!</Container> | |||
</FluentProvider> | |||
</FluentProvider> | |||
)) | |||
.addStory('RTL: propagation of styles via providers with different directions', () => ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't support this scenario.
@@ -9,10 +9,10 @@ import { | |||
MakeStylesStyleRule, | |||
} from './types'; | |||
|
|||
type Created<Slots extends string> = Record<Slots, Record<string, MakeStylesResolvedRule>>; | |||
type ResolvedStylesBySlots<Slots extends string> = Record<Slots, Record<string, MakeStylesResolvedRule>>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This type missed proper naming 😿
Asset size changes
Baseline commit: 0b50201e6e8469298bbc9472161fe51bcaaff6f1 (build) |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 48b970c:
|
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Perf comparison
Perf tests with no regressions
|
@@ -8,4 +8,4 @@ export const RTL_PREFIX = 'r'; | |||
|
|||
export const SEQUENCE_PREFIX = '__'; | |||
|
|||
export const DEFINITION_LOOKUP_TABLE: Record<string, MakeStylesMatchedDefinitions> = {}; | |||
export const DEFINITION_LOOKUP_TABLE: Record<string, [MakeStylesMatchedDefinitions, boolean /* isRTL */]> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFINITION_LOOKUP_TABLE
now knows about definitions' text direction, it works because each key in it is a hash and it's unique for LTR/RTL.
…ix/ax-no-context � Conflicts: � packages/make-styles/src/constants.ts
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
🎉 Handy links: |
* fix: update RTL in ax() * Change files * fix ax() usage * cleanup files
Addresses an existing issue: Fixes #0000$ yarn change
Why?
I tried to use
useAx()
in rest of codebase and discovered a problem, we useax()
to merge classes conditionally, but React hooks can't be conditional:Description of changes
This PR reworks changes that we introduced in #17549. A context subscription was required to support cross-boundary scenarios (passing overrides between providers with different text directions, check removed stories). However, during offline conversations we agreed that we can drop this scenario as it's not required. I added an error in development to notice consumers that this scenario is not supported.
ax() signature reverted back
The signature of
ax()
function@fluentui/make-styles
have been reverted back:useAx() is removed
#17549 introduced
useAx()
in@fluentui/react-make-styles
, it consumed a React Context and was a React hook. I reverted this change: