[PR #8898] [MERGED] fix(client): Add models keeps a just-picked model and spares saved media connections #8871

Closed
opened 2026-11-07 17:40:23 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8898
Author: @SpicyMarinara
Created: 11/5/2026
Status: ✅ Merged
Merged: 11/5/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/v252-add-models-keeps-picks


📝 Commits (1)

  • 5856ba1 fix(client): Add models keeps a model picked just before Done, and spares saved media connections

📊 Changes

5 files changed (+109 additions, -2 deletions)

View changed files

📝 e2e/add-connection-media.e2e.ts (+86 -0)
📝 packages/client/src/components/modals/create-connection/CreateConnectionModalContent.tsx (+6 -1)
📝 packages/client/src/components/modals/create-connection/ModelsStep.tsx (+4 -0)
📝 packages/client/src/components/modals/create-connection/shared.tsx (+2 -0)
📝 packages/client/src/hooks/use-connections.ts (+11 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #8897

Why this change

The v2.5.2 promotion's full matrix caught a real bug, and the maintainer chose to fix it before the release. Both problems are new since the account-first Connections (#8456); v2.5.1 is unaffected.

  • Bug 1: tapping a model and then Done, close or Escape before its save finished deleted the model just added.
    • The model picker saves through its own copy of the update and pin hooks. The update waits for four refetches, which for ComfyUI is three calls to the server. Only then is the pick recorded.
    • Until then the window had no pick, so closing threw its new row away. The CI trace shows the DELETE 180 ms after Done.
  • Bug 2: starting an image or video setup on an account deleted that account's other media connection if it had no model, taking it for the empty row Connect leaves.
    • A saved ComfyUI connection whose workflow names its own checkpoint has no model, so it was deleted along with its workflow.

What changed

  • useUpdateConnection and useSetConnectionModelPinned share a mutation key, and useIsConnectionSaving() reports whether either is running.
  • The Add window's Done, close and Back wait while a save is running, so the pick is always recorded first.
  • The leftover cleanup in ModelsStep replaces only a truly empty row: no model, no workflow, no parameters. Connect's own empty row still gets replaced.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Manual verification notes

  • Manually verify that tapping a model in Add models and then Done right away keeps it, on a slow or remote ComfyUI.
  • Manually verify that Add models → Video on an account with a workflow-only ComfyUI image connection leaves that connection in place.

Agent-run checks:

  • A new e2e test in add-connection-media.e2e.ts, desktop-chromium:
    • What it does: starts with a saved workflow-only ComfyUI image connection, opens Add models → Video, and delays the model list's reload by 2.5 s. It then picks a model and clicks Done at once.
    • Without the fix: it fails on the saved connection being deleted.
    • With only the "wait for the save" part removed: it fails 2 of 2 on the picked model being deleted.
  • With the fix: add-connection-media.e2e.ts and add-connection.e2e.ts, 15/15 passed.
  • Client tsc --noEmit, check:e2e-types and Prettier: pass.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8898 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 11/5/2026 **Status:** ✅ Merged **Merged:** 11/5/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/v252-add-models-keeps-picks` --- ### 📝 Commits (1) - [`5856ba1`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5856ba1939cfbe5c05425e52cc3a8e3189c7731a) fix(client): Add models keeps a model picked just before Done, and spares saved media connections ### 📊 Changes **5 files changed** (+109 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `e2e/add-connection-media.e2e.ts` (+86 -0) 📝 `packages/client/src/components/modals/create-connection/CreateConnectionModalContent.tsx` (+6 -1) 📝 `packages/client/src/components/modals/create-connection/ModelsStep.tsx` (+4 -0) 📝 `packages/client/src/components/modals/create-connection/shared.tsx` (+2 -0) 📝 `packages/client/src/hooks/use-connections.ts` (+11 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #8897 ## Why this change The v2.5.2 promotion's full matrix caught a real bug, and the maintainer chose to fix it before the release. Both problems are new since the account-first Connections (#8456); v2.5.1 is unaffected. - **Bug 1:** tapping a model and then **Done**, close or Escape before its save finished deleted the model just added. - The model picker saves through its own copy of the update and pin hooks. The update waits for four refetches, which for ComfyUI is three calls to the server. Only then is the pick recorded. - Until then the window had no pick, so closing threw its new row away. The CI trace shows the `DELETE` 180 ms after Done. - **Bug 2:** starting an image or video setup on an account deleted that account's other media connection if it had no model, taking it for the empty row Connect leaves. - A saved ComfyUI connection whose workflow names its own checkpoint has no model, so it was deleted along with its workflow. ## What changed - `useUpdateConnection` and `useSetConnectionModelPinned` share a mutation key, and `useIsConnectionSaving()` reports whether either is running. - The Add window's **Done**, close and Back wait while a save is running, so the pick is always recorded first. - The leftover cleanup in `ModelsStep` replaces only a truly empty row: no model, no workflow, no parameters. Connect's own empty row still gets replaced. ## Validation <!-- These are human tasks. Never tick a box for a check that was not actually performed. --> - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes - Manually verify that tapping a model in **Add models** and then **Done** right away keeps it, on a slow or remote ComfyUI. - Manually verify that **Add models** → **Video** on an account with a workflow-only ComfyUI image connection leaves that connection in place. Agent-run checks: - A new e2e test in `add-connection-media.e2e.ts`, desktop-chromium: - **What it does:** starts with a saved workflow-only ComfyUI image connection, opens **Add models** → **Video**, and delays the model list's reload by 2.5 s. It then picks a model and clicks **Done** at once. - **Without the fix:** it fails on the saved connection being deleted. - **With only the "wait for the save" part removed:** it fails 2 of 2 on the picked model being deleted. - With the fix: `add-connection-media.e2e.ts` and `add-connection.e2e.ts`, 15/15 passed. - Client `tsc --noEmit`, `check:e2e-types` and Prettier: pass. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:40:23 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8871
No description provided.