Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): harden pairing UI for RTL locales and the wwebjs link handshake (#552)

Yudhi Armyndharis9e566e7a9248
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4db4b8c3d..7644801ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- **Link a WhatsApp session by pairing code from the dashboard.** The session connect modal now offers a "Link with Phone Number" tab next to the QR code: enter a phone number in international format and the dashboard requests an 8-character pairing code — via the existing `POST /sessions/:id/pairing-code` endpoint — to type into WhatsApp on the phone, a QR-free way to link a device. The phone field is constrained to digits with a numeric keypad, the code/instructions are fully localized across all 10 dashboard locales, and the pairing panel is keyboard- and screen-reader-accessible. (#551) Thanks @akash247777.
+### Fixed
+
+- **Pairing code renders in the correct order in right-to-left locales.** In Arabic/Hebrew the 8-character code's two halves could be transposed by the bidi algorithm (a code like `1234ABCD` shown as `ABCD - 1234`), causing the user to type the wrong code; the code display is now isolated to left-to-right. The pairing connect modal also no longer disappears mid-link on the whatsapp-web.js engine (it stayed mounted only through `authenticating`), and a rapid double-Enter can no longer fire overlapping pairing-code requests. (#552)
+
## [0.7.15] - 2026-06-30
### Added
diff --git a/dashboard/src/pages/Sessions.css b/dashboard/src/pages/Sessions.css
index d79f0c1da..a6c40d4dd 100644
--- a/dashboard/src/pages/Sessions.css
+++ b/dashboard/src/pages/Sessions.css
@@ -779,13 +779,13 @@
padding: 0.75rem;
border-radius: 8px;
font-size: 0.875rem;
- text-align: left;
+ text-align: start;
color: var(--error);
background: rgb(239 68 68 / 0.12);
}
.sessions-page .pairing-form {
- text-align: left;
+ text-align: start;
}
.sessions-page .pairing-label {
@@ -809,6 +809,9 @@
display: flex;
align-items: center;
justify-content: center;
+ /* Force LTR so the two code halves never get reordered by the bidi algorithm in RTL locales. */
+ direction: ltr;
+ unicode-bidi: isolate;
gap: 0.75rem;
font-size: 2rem;
font-weight: 700;
diff --git a/dashboard/src/pages/Sessions.tsx b/dashboard/src/pages/Sessions.tsx
index c2df97ba4..4f413246d 100644
--- a/dashboard/src/pages/Sessions.tsx
+++ b/dashboard/src/pages/Sessions.tsx
@@ -128,9 +128,12 @@ export function Sessions() {
}
} catch {
// Keep qrData alive so the polling interval keeps retrying until the QR
- // is ready. Only stop polling if the session itself has failed.
+ // is ready. Only stop polling if the session itself has failed. 'authenticating' is included so
+ // the modal (and the pairing-code panel mounted in it) survives the brief post-link handshake
+ // instead of being torn down mid-pairing — it closes on the real 'ready'/'failed' transition.
const updated = await sessionApi.get(sessionId).catch(() => null);
- const stillInitializing = updated && ['initializing', 'connecting', 'qr_ready'].includes(updated.status);
+ const stillInitializing =
+ updated && ['initializing', 'connecting', 'qr_ready', 'authenticating'].includes(updated.status);
if (!stillInitializing) {
setQrData(null);
currentSessionName.current = '';
@@ -162,6 +165,9 @@ export function Sessions() {
}, []);
const handleGeneratePairingCode = async () => {
+ // Guard against a second concurrent request: the button is disabled while in flight, but the
+ // input's Enter handler is not, so a rapid double-Enter would otherwise fire overlapping POSTs.
+ if (requestingPairing) return;
if (!qrData || !phoneNumber.trim()) return;
if (!/^[0-9]{6,15}$/.test(phoneNumber.trim())) {
setPairingError(t('sessions.pairing.invalidPhone'));