Uh oh!
There was an error while loading. Please reload this page.
[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
eddd363Comparekennethkalmer
commented
Mar 28, 2025
Is there is a simple flow for me to test this, just to make sure my tired brain marries the code with the behaviour? |
jamiehenson
commented
Mar 28, 2025
@kennethkalmer Matt's gif is probs the best test for it (https://ably-real-time.slack.com/archives/C01LR5XFHFX/p1743120911961429) |
kennethkalmer
commented
Mar 28, 2025
It just dawned on me that gif is in #2497 as well 🤦 |
kennethkalmer
left a comment
There was a problem hiding this comment.
Works nicely @jamiehenson
eddd363 to
7279370Compare
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
PageLanguageContextwith 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: ReplacedusePageLanguagewithuseLayoutContextto manage language state.src/components/Layout/utils/nav.ts: Updated theActivePagetype anddetermineActivePagefunction to include the new language context. [1][2][3]src/components/Link/LanguageLink.tsx: ReplacedusePageLanguagewithuseLayoutContextfor language handling.src/components/Menu/LanguageNavigation/LanguageNavigation.tsx: Updated to useuseLayoutContextinstead ofusePageLanguage. [1][2][3]Test Updates:
src/components/LanguageButton/LanguageButton.test.tsx: ReplacedPageLanguageContextwithLayoutProviderin tests. [1][2][3][4]src/components/blocks/Html/Html.test.tsx: Updated tests to useLayoutProviderinstead ofPageLanguageContext.src/components/blocks/software/Pre.test.tsx: Modified tests to useLayoutProviderfor context. [1][2][3][4]Component Updates:
src/components/blocks/Html/LinkableHtmlBlock.js: ReplacedusePageLanguagewithuseLayoutContextfor language checks.src/components/blocks/api-reference/dividers/ApiReferenceDiv.tsx: Updated to useuseLayoutContextfor language matching. [1][2]src/components/blocks/api-reference/dividers/ApiReferenceSpan.tsx: ReplacedusePageLanguagewithuseLayoutContextfor language checks.src/components/blocks/list/Dl/DlWrapper.tsx: Updated to useuseLayoutContextinstead ofusePageLanguage.These changes ensure that the new
LayoutContextis consistently used across the codebase, replacing the oldPageLanguageContext.