From 710f5d93c890a4d7e116e2e559a5a792a5450048 Mon Sep 17 00:00:00 2001 From: Flamur Veliqi Date: Mon, 23 Feb 2026 15:14:48 +0100 Subject: [PATCH] nx-webmail: fix hydration race and ensure continued inbox loading --- nx-webmail/README.md | 4 ++-- nx-webmail/docker-compose.yml | 2 +- nx-webmail/src/components/Webmail.jsx | 6 ++++++ nx-webmail/umbrel-app.yml | 4 ++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/nx-webmail/README.md b/nx-webmail/README.md index a25daac..1f5254f 100644 --- a/nx-webmail/README.md +++ b/nx-webmail/README.md @@ -30,7 +30,7 @@ Umbrel installation is most reliable when your app uses a prebuilt image from a - `git.weektab.org/nexus/nx-webmail:latest` 3. The workflow then pins `nx-webmail/docker-compose.yml` to `tag@sha256:digest` automatically. 4. Manual fallback: - docker buildx build --platform linux/amd64,linux/arm64 -t git.weektab.org/nexus/nx-webmail:1.0.8 --push . + docker buildx build --platform linux/amd64,linux/arm64 -t git.weektab.org/nexus/nx-webmail:1.0.9 --push . ## Umbrel app packaging @@ -55,7 +55,7 @@ This repository is prepared for Umbrel app-store usage. Notes: - Umbrel uses the `app_proxy` service in `docker-compose.yml`. - Internal app port is `3001`. -- `server` uses a prebuilt registry image (`git.weektab.org/nexus/nx-webmail:1.0.8`). +- `server` uses a prebuilt registry image (`git.weektab.org/nexus/nx-webmail:1.0.9`). - If your store prefix changes, update `id` in `umbrel-app.yml` and `APP_HOST` in `docker-compose.yml`. ## Notes diff --git a/nx-webmail/docker-compose.yml b/nx-webmail/docker-compose.yml index 0612490..0bc8ae2 100644 --- a/nx-webmail/docker-compose.yml +++ b/nx-webmail/docker-compose.yml @@ -7,7 +7,7 @@ services: APP_PORT: 3001 server: - image: git.weektab.org/nexus/nx-webmail:1.0.8@sha256:db773eea0c6d836360ad52a7e55f25d5f1b3684a73e2cbce21d4c1fec55137f5 + image: git.weektab.org/nexus/nx-webmail:1.0.9@sha256:bd8d9c38edbc43924a69509d7d1e19e343ead17e7d87f7b52dda540f09e9a3e9 init: true restart: on-failure stop_grace_period: 1m diff --git a/nx-webmail/src/components/Webmail.jsx b/nx-webmail/src/components/Webmail.jsx index 203fc13..b7934ca 100644 --- a/nx-webmail/src/components/Webmail.jsx +++ b/nx-webmail/src/components/Webmail.jsx @@ -381,6 +381,10 @@ export default function Webmail() { && baseEmailsForSync.length > 0 && lastLoadedDirection === 'newest'; + // Keep refs in sync immediately to avoid stale-closure race conditions + // during progressive hydration and background refresh operations. + activeFolderRef.current = folder; + activeAccountIdRef.current = accountId; setActiveFolder(folder); if (!append && !forceRefresh && cachedFolderEmails.length > 0) { const initial = shouldResetWindow @@ -606,12 +610,14 @@ export default function Webmail() { setFolders(normalized); setIsLoggedIn(true); setIsAddingAccount(false); + activeAccountIdRef.current = accountId; setActiveAccountId(accountId); const defaultFolder = normalized.find((f) => String(f.name).toUpperCase() === String(lastFolder || '').toUpperCase())?.name || normalized.find((f) => String(f.name).toUpperCase() === 'INBOX')?.name || normalized[0]?.name || 'INBOX'; + activeFolderRef.current = defaultFolder; const cachedDefaultFolderEntry = accountCache?.emailsByFolder?.[defaultFolder]; const cachedDefaultEmails = Array.isArray(cachedDefaultFolderEntry) diff --git a/nx-webmail/umbrel-app.yml b/nx-webmail/umbrel-app.yml index 2d60c4c..de6c340 100644 --- a/nx-webmail/umbrel-app.yml +++ b/nx-webmail/umbrel-app.yml @@ -4,7 +4,7 @@ name: Webmail tagline: Self-hosted IMAP/SMTP webmail client icon: https://git.weektab.org/nexus/umbrel-apps/raw/branch/main/gallery/webmail/icon.png category: utilities -version: "1.0.8" +version: "1.0.9" port: 3001 description: >- Webmail is a lightweight, self-hosted webmail app for connecting to external @@ -17,7 +17,7 @@ repo: https://git.weektab.org/nexus/webmail support: https://git.weektab.org/nexus/webmail/issues gallery: [] releaseNotes: >- - Added robust paged auto-hydration after login to improve sync consistency in Docker. + Fixed hydration race condition so full inbox loading continues reliably after login. dependencies: [] path: "" defaultUsername: ""