feat(loops): edit instructions inline on loop detail#3717
Merged
Conversation
Pull instructions out of the config panel into its own box that's editable in place. Click into the textarea to edit, saves on blur via the existing PATCH; Escape reverts. Removes the round-trip through the full edit wizard just to tweak the prompt. Generated-By: PostHog Code Task-Id: 8a18478b-2989-4a7c-93f6-c54d3db955f0
|
😎 This pull request was merged. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Generated-By: PostHog Code Task-Id: e5c17bb5-1f87-40c7-9891-0fa72f3e63a9
MattPua
marked this pull request as ready for review
July 22, 2026 15:13
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
packages/ui/src/features/loops/components/LoopDetailView.tsx:317-324
**Instruction Formatting Is Stripped**
When instructions contain meaningful leading spaces or trailing newlines, blur sends `value.trim()` instead of the text entered. The saved prompt silently loses that formatting; trimming should only detect blank input, while comparison and persistence should use the original value.
```suggestion
if (!value.trim()) {
if (textareaRef.current) textareaRef.current.value = loop.instructions;
return;
}
if (value === loop.instructions || updateLoop.isPending) return;
updateLoop.mutate(
{ instructions: value },
```
### Issue 2 of 2
packages/ui/src/features/loops/components/LoopDetailView.tsx:349-351
**Background Updates Discard Drafts**
The textarea key is the last saved instructions value, so a detail-query refresh that returns changed instructions remounts the field. If someone is typing when a window-focus refresh or concurrent update arrives, their unblurred draft disappears without warning.
Reviews (1): Last reviewed commit: "fix(loops): align inline editor with qui..." | Re-trigger Greptile |
Generated-By: PostHog Code Task-Id: e5c17bb5-1f87-40c7-9891-0fa72f3e63a9
charlesvien
approved these changes
Jul 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Editing a loop's instructions on the detail page meant opening the full 4-step edit wizard just to tweak the prompt. The instructions were shown read-only in the config panel.
Changes
PATCH(useUpdateLoop); a subtle "Saving…" shows while in flightHow did you test this?
pnpm --filter @posthog/ui typecheckpassesbiome checkclean on the changed fileAutomatic notifications
Created with PostHog Code