nx-webmail: fix hydration race and ensure continued inbox loading
Some checks failed
Publish nx-webmail Image (Gitea) / publish (push) Has been cancelled

This commit is contained in:
2026-02-23 15:14:48 +01:00
parent 4277786459
commit 710f5d93c8
4 changed files with 11 additions and 5 deletions

View File

@@ -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` - `git.weektab.org/nexus/nx-webmail:latest`
3. The workflow then pins `nx-webmail/docker-compose.yml` to `tag@sha256:digest` automatically. 3. The workflow then pins `nx-webmail/docker-compose.yml` to `tag@sha256:digest` automatically.
4. Manual fallback: 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 ## Umbrel app packaging
@@ -55,7 +55,7 @@ This repository is prepared for Umbrel app-store usage.
Notes: Notes:
- Umbrel uses the `app_proxy` service in `docker-compose.yml`. - Umbrel uses the `app_proxy` service in `docker-compose.yml`.
- Internal app port is `3001`. - 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`. - If your store prefix changes, update `id` in `umbrel-app.yml` and `APP_HOST` in `docker-compose.yml`.
## Notes ## Notes

View File

@@ -7,7 +7,7 @@ services:
APP_PORT: 3001 APP_PORT: 3001
server: 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 init: true
restart: on-failure restart: on-failure
stop_grace_period: 1m stop_grace_period: 1m

View File

@@ -381,6 +381,10 @@ export default function Webmail() {
&& baseEmailsForSync.length > 0 && baseEmailsForSync.length > 0
&& lastLoadedDirection === 'newest'; && 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); setActiveFolder(folder);
if (!append && !forceRefresh && cachedFolderEmails.length > 0) { if (!append && !forceRefresh && cachedFolderEmails.length > 0) {
const initial = shouldResetWindow const initial = shouldResetWindow
@@ -606,12 +610,14 @@ export default function Webmail() {
setFolders(normalized); setFolders(normalized);
setIsLoggedIn(true); setIsLoggedIn(true);
setIsAddingAccount(false); setIsAddingAccount(false);
activeAccountIdRef.current = accountId;
setActiveAccountId(accountId); setActiveAccountId(accountId);
const defaultFolder = normalized.find((f) => String(f.name).toUpperCase() === String(lastFolder || '').toUpperCase())?.name const defaultFolder = normalized.find((f) => String(f.name).toUpperCase() === String(lastFolder || '').toUpperCase())?.name
|| normalized.find((f) => String(f.name).toUpperCase() === 'INBOX')?.name || normalized.find((f) => String(f.name).toUpperCase() === 'INBOX')?.name
|| normalized[0]?.name || normalized[0]?.name
|| 'INBOX'; || 'INBOX';
activeFolderRef.current = defaultFolder;
const cachedDefaultFolderEntry = accountCache?.emailsByFolder?.[defaultFolder]; const cachedDefaultFolderEntry = accountCache?.emailsByFolder?.[defaultFolder];
const cachedDefaultEmails = Array.isArray(cachedDefaultFolderEntry) const cachedDefaultEmails = Array.isArray(cachedDefaultFolderEntry)

View File

@@ -4,7 +4,7 @@ name: Webmail
tagline: Self-hosted IMAP/SMTP webmail client tagline: Self-hosted IMAP/SMTP webmail client
icon: https://git.weektab.org/nexus/umbrel-apps/raw/branch/main/gallery/webmail/icon.png icon: https://git.weektab.org/nexus/umbrel-apps/raw/branch/main/gallery/webmail/icon.png
category: utilities category: utilities
version: "1.0.8" version: "1.0.9"
port: 3001 port: 3001
description: >- description: >-
Webmail is a lightweight, self-hosted webmail app for connecting to external 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 support: https://git.weektab.org/nexus/webmail/issues
gallery: [] gallery: []
releaseNotes: >- 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: [] dependencies: []
path: "" path: ""
defaultUsername: "" defaultUsername: ""