Skip to content

Set the layout direction before MainLayout loads the current user #13893 - #13894

Merged
yasmoradi merged 2 commits into
bitfoundation:developfrom
Mohammadzarei754:fix/13893-set-current-dir-before-loading-the-user
Oct 18, 2026
Merged

yasmoradi merged 2 commits into
bitfoundation:developfrom
Mohammadzarei754:fix/13893-set-current-dir-before-loading-the-user

Conversation

@Mohammadzarei754

@Mohammadzarei754 Mohammadzarei754 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Moves SetCurrentDir() in the Boilerplate's MainLayout.OnInitializedAsync to run before anything is awaited, so an RTL culture gets its direction on the first render and keeps it when loading the current user fails.

Changes

  • MainLayout.razor.cs: call SetCurrentDir() first, outside the try, instead of after await SetCurrentUser(...). It only reads CultureInfo.CurrentUICulture, so it does not depend on the user. Previously a cancelled or failed GetCurrentUser request skipped it, and CurrentDir stayed null (left to right) until a refresh.

Related Issue

This closes #13893

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • The current directory is now set earlier during layout startup, before asynchronous initialization and current-user setup. This makes the directory context available sooner as the layout initializes, helping avoid startup behavior that depends on when that context is established.

…foundation#13893

SetCurrentDir ran after awaiting SetCurrentUser, so the first render had no
direction, and a cancelled or failed GetCurrentUser request skipped it for
the whole session, leaving RTL cultures laid out left to right.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 42d1d675-1578-4ac8-bad9-628f9a78c29d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1738d7cf-8c65-4751-b089-e091a0c82060
📥 Commits

Reviewing files that changed from the base of the PR and between d2334e7 and 91cdd65.

📒 Files selected for processing: 1
  • src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

MainLayout.OnInitializedAsync now sets the current direction before entering the try block and before awaiting user initialization. The later call to SetCurrentDir after SetCurrentUser was removed.

Changes

Layout direction initialization

Layer / File(s) Summary
Set direction before user loading
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Layout/MainLayout.razor.cs
OnInitializedAsync calls SetCurrentDir before the try block and removes the call after SetCurrentUser.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 91cdd

RTL direction is established before current-user loading, including when that loading fails or is canceled. No actionable merge risk was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Linked Issues check Passed Issue #13893 requires MainLayout.OnInitializedAsync to set the direction before SetCurrentUser can remain pending, fail, or be canceled. The diff calls SetCurrentDir() before SetCurrentUser an…
Out of Scope Changes check Passed The diff changes only MainLayout.razor.cs. The change moves SetCurrentDir() to address the RTL direction failure described in issue #13893. The added comment documents the same behavior. No unrela…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: setting the layout direction before MainLayout loads the current user.
Full details: Linked Issues check

Explanation

Issue #13893 requires MainLayout.OnInitializedAsync to set the direction before SetCurrentUser can remain pending, fail, or be canceled. The diff calls SetCurrentDir() before SetCurrentUser and places the call outside the try block. This preserves the direction when current-user loading fails or is canceled and supports the first render for the current UI culture.

Full details: Out of Scope Changes check

Explanation

The diff changes only MainLayout.razor.cs. The change moves SetCurrentDir() to address the RTL direction failure described in issue #13893. The added comment documents the same behavior. No unrelated implementation is shown.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I set the direction before the wait,
So right-to-left can start in place.
No user load must come before,
The layout knows its way once more.
A rabbit hops through pages bright.

Comment @coderabbitai help to get the list of available commands.

@yasmoradi yasmoradi changed the title fix(templates): set the layout direction before MainLayout loads the current user #13893 Set the layout direction before MainLayout loads the current user #13893 Oct 18, 2026
Signed-off-by: Yas Moradi <yas_moradi@outlook.com>
@yasmoradi
yasmoradi merged commit d827d77 into bitfoundation:develop Oct 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boilerplate pages stay left to right in an RTL culture when MainLayout fails to load the current user

2 participants