Fix project action preview settings persistence
What Changed
- Preserve
previewUrlandautoOpenPreviewwhen creating or updating project actions. - Use a shared mapper for both save paths and omit preview settings when the preview URL is cleared.
- Add regression coverage for saving and removing project action preview settings.
Why
Project actions allow users to configure an optional preview URL. However, when an action was created or edited with a preview URL, saving the action silently discarded both the URL and the associated auto-open preference. Reopening the action therefore showed an empty preview URL field.
The form already included previewUrl and autoOpenPreview in its payload, but ChatView rebuilt the ProjectScript without those fields before calling the project update command. As a result, the preview settings never reached persistence.
Using the same mapper for create and update keeps both save paths consistent. It also ensures that intentionally clearing the preview URL removes the associated preview settings instead of retaining stale values.
Validation
pnpm exec vp test apps/web/src/projectScripts.test.tspnpm exec vp checkpnpm exec vp run typecheck
Checklist
- [x] This PR is small and focused
- [x] I explained what changed and why
- [x] No UI changes; screenshots are not applicable
- [x] No animation or interaction changes; a video is not applicable
[!NOTE] Low Risk Localized persistence fix with unit tests; no auth, security, or broad architectural changes.
Overview Fixes a bug where project action create/update dropped
previewUrlandautoOpenPreviewbeforeupdateProject, so preview settings never saved even though the form sent them.Introduces shared
buildProjectScriptinprojectScripts.tsfor both save paths. It maps core fields plus preview options when a URL is set, and omits preview fields whenpreviewUrlisnullso clearing the URL does not leave stale values.ChatViewsaveProjectScript/updateProjectScriptnow call this helper instead of inlineProjectScriptobjects. Regression tests cover saving preview settings and omitting them when the URL is cleared.Reviewed by Cursor Bugbot for commit e88ef5189aa19a139084f4e98f9a09696b834429. Bugbot is set up for automated code reviews on this repo. Configure here.
[!NOTE]
Fix project action preview settings persistence when saving or updating scripts
- Adds a
buildProjectScriptutility in projectScripts.ts that conditionally includespreviewUrlandautoOpenPreviewonly whenpreviewUrlis non-null, omitting those fields otherwise.- Updates
saveProjectScriptandupdateProjectScriptin ChatView.tsx to usebuildProjectScriptinstead of inline object construction, ensuring preview settings are correctly persisted or cleared.- Behavioral Change: Previously, updating a script with a null
previewUrlcould leave stale preview fields on the stored object; now those fields are explicitly removed.Macroscope summarized e88ef51.
[!IMPORTANT]
Review skipped
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID:
c03d6612-1226-40f4-adc0-a26109e2fac7You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- [ ] 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Approvability
Verdict: Approved
Straightforward bug fix that adds missing preview settings persistence via a new helper function. The change is small, self-contained, and includes unit tests validating the behavior.
You can customize Macroscope's approvability policy. Learn more.