Fix project action preview settings persistence#3842
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
ApprovabilityVerdict: 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. |
What Changed
previewUrlandautoOpenPreviewwhen creating or updating project actions.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
previewUrlandautoOpenPreviewin its payload, butChatViewrebuilt theProjectScriptwithout 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 typecheckChecklist
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 e88ef51. 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
buildProjectScriptutility in projectScripts.ts that conditionally includespreviewUrlandautoOpenPreviewonly whenpreviewUrlis non-null, omitting those fields otherwise.saveProjectScriptandupdateProjectScriptin ChatView.tsx to usebuildProjectScriptinstead of inline object construction, ensuring preview settings are correctly persisted or cleared.previewUrlcould leave stale preview fields on the stored object; now those fields are explicitly removed.Macroscope summarized e88ef51.