[PR #4263] [MERGED] Fix media prompt edits reverting before generation #6307

Closed
opened 2026-10-23 04:09:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/4263
Author: @SpicyMarinara
Created: 7/29/2026
Status: ✅ Merged
Merged: 7/29/2026
Merged by: @SpicyMarinara

Base: staging ← Head: agent/fix-media-prompt-edit-race-4262


📝 Commits (1)

  • e087974 Fix media prompt edit race

📊 Changes

2 files changed (+104 additions, -4 deletions)

View changed files

📝 e2e/core-flows.e2e.ts (+85 -0)
📝 packages/client/src/components/ui/ImagePromptReviewModal.tsx (+19 -4)

📄 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 #4262

Why this change

  • Image prompt review drafts were reinitialized whenever a parent supplied an equivalent items array with a new identity. Routine chat rerenders could therefore erase edits, and clicking Generate guaranteed a rerender when submission state changed.

What changed

  • Key draft initialization to the actual source prompt content and modal-open lifecycle, preserving user edits across equivalent parent rerenders.
  • Add a browser regression that edits an Illustrator prompt, forces a parent state update, holds Generate in flight, and verifies the exact edited override is submitted.

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

Automated evidence:

  • pnpm check
  • pnpm exec playwright test -c playwright.config.ts --grep "image prompt review preserves": 2 passed (desktop Chromium and mobile Chromium).
  • pnpm smoke:ui: the new prompt-review regression passed on both projects within the full run. Overall, 150 passed, 86 skipped, and 12 unrelated pre-existing tests failed.
  • pnpm exec playwright test -c playwright.config.ts --last-failed: the same 12 unrelated failures reproduced from a fresh data directory. They are existing accent-color expectations, a tracker empty-state expectation, and background-library tooltip/API cleanup timeouts; none exercises ImagePromptReviewModal.

Manual verification notes

  • Manually verify the real Illustrator flow with "Expose media prompts before sending" enabled in iOS Safari and Docker.
  • Manually confirm edited positive and negative prompts remain visible while Generate is pending and reach the configured image provider.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

UI evidence (if applicable)

No visual design changed; this PR preserves in-progress editor state.

Summary by CodeRabbit

  • Bug Fixes

    • Preserved edited image prompts when the review dialog refreshes or changes state.
    • Ensured the edited prompt is submitted when generating an image.
    • Prevented unintended draft resets while the dialog remains open.
  • Tests

    • Added end-to-end coverage for editing, rerendering, submitting, and closing the image prompt review dialog.

🔄 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/4263 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 7/29/2026 **Status:** ✅ Merged **Merged:** 7/29/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `agent/fix-media-prompt-edit-race-4262` --- ### 📝 Commits (1) - [`e087974`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e087974ccb72c4c2f06226e73464539f403249f8) Fix media prompt edit race ### 📊 Changes **2 files changed** (+104 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `e2e/core-flows.e2e.ts` (+85 -0) 📝 `packages/client/src/components/ui/ImagePromptReviewModal.tsx` (+19 -4) </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 #4262 ## Why this change - Image prompt review drafts were reinitialized whenever a parent supplied an equivalent `items` array with a new identity. Routine chat rerenders could therefore erase edits, and clicking Generate guaranteed a rerender when submission state changed. ## What changed - Key draft initialization to the actual source prompt content and modal-open lifecycle, preserving user edits across equivalent parent rerenders. - Add a browser regression that edits an Illustrator prompt, forces a parent state update, holds Generate in flight, and verifies the exact edited override is submitted. ## 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` Automated evidence: - `pnpm check` - `pnpm exec playwright test -c playwright.config.ts --grep "image prompt review preserves"`: 2 passed (desktop Chromium and mobile Chromium). - `pnpm smoke:ui`: the new prompt-review regression passed on both projects within the full run. Overall, 150 passed, 86 skipped, and 12 unrelated pre-existing tests failed. - `pnpm exec playwright test -c playwright.config.ts --last-failed`: the same 12 unrelated failures reproduced from a fresh data directory. They are existing accent-color expectations, a tracker empty-state expectation, and background-library tooltip/API cleanup timeouts; none exercises `ImagePromptReviewModal`. ### Manual verification notes - Manually verify the real Illustrator flow with "Expose media prompts before sending" enabled in iOS Safari and Docker. - Manually confirm edited positive and negative prompts remain visible while Generate is pending and reach the configured image provider. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) ## UI evidence (if applicable) No visual design changed; this PR preserves in-progress editor state. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Preserved edited image prompts when the review dialog refreshes or changes state. * Ensured the edited prompt is submitted when generating an image. * Prevented unintended draft resets while the dialog remains open. * **Tests** * Added end-to-end coverage for editing, rerendering, submitting, and closing the image prompt review dialog. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-23 04:09:10 +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#6307
No description provided.