Skip to content

chore: Revert "fix: optimize session handling in useLocalizationConfig (#3256)" - #3257

Merged
eduardoformiga merged 1 commit into
canary-v2from
revert-3256-fix/race-condition-use-localization-config
Apr 1, 2026
Merged

eduardoformiga merged 1 commit into
canary-v2from
revert-3256-fix/race-condition-use-localization-config

Conversation

@eduardoformiga

@eduardoformiga eduardoformiga commented Apr 1, 2026 •

Copy link
Copy Markdown
Member

This reverts commit 6d4e6df.

What's the purpose of this pull request?

How it works?

How to test it?

Starters Deploy Preview

References

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits specification
    • Available prefixes: feat, fix, chore, docs, style, refactor, ci and test

PR Description

  • Added a label according to the PR goal - breaking change, bug, contributing, performance, documentation..

Dependencies

  • Committed the pnpm-lock.yaml file when there were changes to the packages

Documentation

  • PR description
  • For documentation changes, ping @Mariana-Caetano to review and update (Or submit a doc request)

Summary by CodeRabbit

Refactor

  • Enhanced session state management in localization configuration to ensure that all session updates reliably propagate changes throughout components. Initial synchronization is now always performed automatically, improving overall consistency and predictability of locale handling. This change ensures more reliable locale configuration behavior and reduces potential display inconsistencies across the entire application.

@eduardoformiga
eduardoformiga requested a review from a team as a code owner April 1, 2026 20:05
@eduardoformiga
eduardoformiga requested review from lemagnetic and lucasfp13 and removed request for a team April 1, 2026 20:05
@eduardoformiga
eduardoformiga merged commit 641a9f8 into canary-v2 Apr 1, 2026
2 checks passed
@eduardoformiga
eduardoformiga deleted the revert-3256-fix/race-condition-use-localization-config branch April 1, 2026 20:05
@coderabbitai

coderabbitai Bot commented Apr 1, 2026 •

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a1ae0e1e-ce0d-48d0-a16f-c9d8f815d3d4

📥 Commits

Reviewing files that changed from the base of the PR and between 6d4e6df and c5ea167.

📒 Files selected for processing (1)
  • packages/core/src/sdk/localization/useLocalizationConfig.tsx

Walkthrough

Refactored session tracking in the localization config hook from a useRef-based approach with an isFirstMount guard to React state management, changing the session-sync effect to re-run on session updates and removing the conditional delay on initial synchronization.

Changes

Cohort / File(s) Summary
Session State Refactoring
packages/core/src/sdk/localization/useLocalizationConfig.tsx
Replaced sessionRef and isFirstMount guard with React state for session tracking. Updated effect dependencies from [settings] to [settings, session], enabling the effect to re-run when session updates occur, and removed the initial sync gating condition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • vtex/faststore#3256: Directly reverses these changes by replacing state with a ref and re-introducing the isFirstMount guard in the same hook.

Poem

🔄 From refs to state, the session flows,
No guards to block, the sync now grows,
Effect dependencies dance in tune,
Localization blooms anew! 🌍✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch revert-3256-fix/race-condition-use-localization-config

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

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

@codesandbox-ci

codesandbox-ci Bot commented Apr 1, 2026

Copy link
Copy Markdown

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.

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.

1 participant