-
Notifications
You must be signed in to change notification settings - Fork 43
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
[WEB-4294] Persist language choice across pages #2500
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
d89e887
to
eddd363
Compare
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.
LGTM!
Is there is a simple flow for me to test this, just to make sure my tired brain marries the code with the behaviour? |
@kennethkalmer Matt's gif is probs the best test for it (https://ably-real-time.slack.com/archives/C01LR5XFHFX/p1743120911961429) |
It just dawned on me that gif is in #2497 as well 🤦 |
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.
Works nicely @jamiehenson
eddd363
to
7279370
Compare
Unblocks #2497.
Core addition here is the removal of the logic that redirects to a present language if the currently selected language is not in the list of languages supported by the viewed docs entry.
Bot summary:
This pull request refactors the code to replace the usage of
PageLanguageContext
with the newLayoutContext
. The changes involve updating various components and tests to utilize the new context. Here are the most important changes:Context Replacement:
src/components/LanguageButton/LanguageButton.tsx
: ReplacedusePageLanguage
withuseLayoutContext
to manage language state.src/components/Layout/utils/nav.ts
: Updated theActivePage
type anddetermineActivePage
function to include the new language context. [1] [2] [3]src/components/Link/LanguageLink.tsx
: ReplacedusePageLanguage
withuseLayoutContext
for language handling.src/components/Menu/LanguageNavigation/LanguageNavigation.tsx
: Updated to useuseLayoutContext
instead ofusePageLanguage
. [1] [2] [3]Test Updates:
src/components/LanguageButton/LanguageButton.test.tsx
: ReplacedPageLanguageContext
withLayoutProvider
in tests. [1] [2] [3] [4]src/components/blocks/Html/Html.test.tsx
: Updated tests to useLayoutProvider
instead ofPageLanguageContext
.src/components/blocks/software/Pre.test.tsx
: Modified tests to useLayoutProvider
for context. [1] [2] [3] [4]Component Updates:
src/components/blocks/Html/LinkableHtmlBlock.js
: ReplacedusePageLanguage
withuseLayoutContext
for language checks.src/components/blocks/api-reference/dividers/ApiReferenceDiv.tsx
: Updated to useuseLayoutContext
for language matching. [1] [2]src/components/blocks/api-reference/dividers/ApiReferenceSpan.tsx
: ReplacedusePageLanguage
withuseLayoutContext
for language checks.src/components/blocks/list/Dl/DlWrapper.tsx
: Updated to useuseLayoutContext
instead ofusePageLanguage
.These changes ensure that the new
LayoutContext
is consistently used across the codebase, replacing the oldPageLanguageContext
.