Skip to content

[8398] Default title/comment generation updates#4904

Open
jvega190 wants to merge 1 commit into
craftercms:developfrom
jvega190:feature/8398
Open

[8398] Default title/comment generation updates#4904
jvega190 wants to merge 1 commit into
craftercms:developfrom
jvega190:feature/8398

Conversation

@jvega190

@jvega190 jvega190 commented Jun 26, 2026

Copy link
Copy Markdown
Member

Updates in the PublishOnDemand component:

  • Publishing target: add it everywhere consistently
  • Add the default message as a placeholder, if no text is provided, use the default message (that means the field won't be required)

craftercms/craftercms#8398

Summary by CodeRabbit

  • New Features

    • Added dynamic placeholder text for the submission comment field, tailored to the selected publishing mode.
    • Blank comments now automatically use a suggested message when publishing.
  • Bug Fixes

    • Removed the requirement to enter a submission comment before publishing.
    • Improved the comment field’s layout so the label displays more compactly.

…r and use it as default message when submitting
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

PublishOnDemandWidget now derives a mode-specific submission comment placeholder, no longer requires comment for form validity, and substitutes the placeholder when submitting blank comments. PublishOnDemandForm receives the placeholder and uses it for the Submission Comment field.

Changes

Publish-on-demand comment placeholder

Layer / File(s) Summary
Placeholder logic and validity
ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx
useMemo derives submissionCommentPlaceholder from selectedMode and publishingTarget, and currentFormValid no longer requires a non-blank comment.
Form placeholder field
ui/app/src/components/PublishOnDemandForm/PublishOnDemandForm.tsx, ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx
PublishOnDemandFormProps adds submissionCommentPlaceholder, the widget forwards it, and the Submission Comment field uses it as its placeholder with required validation removed.
Blank-comment submit fallback
ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx
Git, Studio, and Everything submission handlers send submissionCommentPlaceholder when comment is blank.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PublishOnDemandWidget
  participant PublishOnDemandForm
  PublishOnDemandWidget->>PublishOnDemandWidget: derive submissionCommentPlaceholder from selectedMode and publishingTarget
  PublishOnDemandWidget->>PublishOnDemandForm: pass submissionCommentPlaceholder
  PublishOnDemandForm-->>User: render Submission Comment placeholder
  User->>PublishOnDemandWidget: submit with blank comment
  PublishOnDemandWidget->>PublishOnDemandWidget: replace blank comment with submissionCommentPlaceholder
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is relevant but too generic to clearly convey the main change. Use a more specific title like 'Make PublishOnDemand comment optional and use it as a placeholder/default message.'
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description includes the ticket reference and a concise summary of the main behavior changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx (1)

203-225: 🎯 Functional Correctness | 🔵 Trivial

Simplify dependency by using currentFormData directly.

The use of useUpdateRefs here is functionally safe because it updates ref.current synchronously during render, so there is no risk of stale data. However, depending on refs.current.currentFormData in the useMemo dependency array is less explicit than depending on the value variable itself. If currentFormData is available in the component scope and holds the same value, use it directly to improve clarity without changing behavior.

♻️ Suggested simplification
 	const submissionCommentPlaceholder = useMemo(() => {
 		let comment = '';
-		const formData = refs.current.currentFormData;
+		const formData = currentFormData;
 
 		if (selectedMode === 'everything' && formData.publishingTarget) {
@@
-	}, [selectedMode, refs.current.currentFormData, formatMessage]);
+	}, [selectedMode, currentFormData, formatMessage]);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx` around
lines 203 - 225, The dependency array for the `useMemo` that builds
`submissionCommentPlaceholder` should use `currentFormData` directly instead of
`refs.current.currentFormData`, since `useUpdateRefs` already keeps the ref in
sync and the scoped value is clearer. Update the `submissionCommentPlaceholder`
memo in `PublishOnDemandWidget` to reference the existing `currentFormData`
variable for dependencies while keeping the same formatting logic for the
`selectedMode` branches.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx`:
- Around line 203-225: The dependency array for the `useMemo` that builds
`submissionCommentPlaceholder` should use `currentFormData` directly instead of
`refs.current.currentFormData`, since `useUpdateRefs` already keeps the ref in
sync and the scoped value is clearer. Update the `submissionCommentPlaceholder`
memo in `PublishOnDemandWidget` to reference the existing `currentFormData`
variable for dependencies while keeping the same formatting logic for the
`selectedMode` branches.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: fae2f6e0-32b4-4fd8-acfe-9db60378c817

📥 Commits

Reviewing files that changed from the base of the PR and between 7d8ec52 and 2aa44d9.

📒 Files selected for processing (2)
  • ui/app/src/components/PublishOnDemandForm/PublishOnDemandForm.tsx
  • ui/app/src/components/PublishOnDemandWidget/PublishOnDemandWidget.tsx

@jvega190

Copy link
Copy Markdown
Member Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Changed files vs base =="
git diff --name-only origin/develop...HEAD || git diff --name-only HEAD~1...HEAD

echo
echo "== Diffstat =="
git diff --stat origin/develop...HEAD || git diff --stat HEAD~1...HEAD

echo
echo "== Outline: PublishOnDemandForm.tsx =="
FORM_FILE=$(fd 'PublishOnDemandForm.tsx' . | head -n1)
echo "$FORM_FILE"
ast-grep outline "$FORM_FILE" --view expanded || true

echo
echo "== Outline: PublishOnDemandWidget.tsx =="
WIDGET_FILE=$(fd 'PublishOnDemandWidget.tsx' . | head -n1)
echo "$WIDGET_FILE"
ast-grep outline "$WIDGET_FILE" --view expanded || true

echo
echo "== Relevant diff: PublishOnDemandForm.tsx =="
git diff origin/develop...HEAD -- "$FORM_FILE" || git diff HEAD~1...HEAD -- "$FORM_FILE"

echo
echo "== Relevant diff: PublishOnDemandWidget.tsx =="
git diff origin/develop...HEAD -- "$WIDGET_FILE" || git diff HEAD~1...HEAD -- "$WIDGET_FILE"

echo
echo "== Current file slice: PublishOnDemandForm.tsx =="
sed -n '1,260p' "$FORM_FILE"

echo
echo "== Current file slice: PublishOnDemandWidget.tsx =="
sed -n '1,340p' "$WIDGET_FILE"

echo
echo "== Search: submissionCommentPlaceholder usages =="
rg -n -C2 'submissionCommentPlaceholder|isBlank\\(comment\\)|comment:' ui/app/src || true

echo
echo "== Search: PublishOnDemandForm callsites =="
rg -n -C2 '<PublishOnDemandForm|PublishOnDemandForm\\(' ui/app/src || true

echo
echo "== Search: comment validation / required markers near widget =="
rg -n -C3 'required|setValidity|isBlank\\(|comment\\s*[:=]' ui/app/src/components/PublishOnDemandWidget ui/app/src/components/PublishOnDemandForm || true

Length of output: 50283



@jvega190 I did a final pass over the actual diff and surrounding logic, and I don’t see any blocking issues.

What I checked:

  • PublishOnDemandForm now treats the submission comment as optional and shows the default text as a placeholder.
  • PublishOnDemandWidget no longer requires comment for form validity.
  • All submit paths now fall back to the generated default comment when the field is left blank.
  • The publishing target is now included consistently in the generated comment across modes.
  • The new submissionCommentPlaceholder prop is wired through cleanly.

Overall this looks aligned with the PR objective and ready for human review.

One quick manual sanity check I’d still recommend before handoff: leave the comment empty, switch modes / publishing targets, and verify the visible placeholder and submitted payload both reflect the latest target.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jvega190 jvega190 marked this pull request as ready for review June 26, 2026 15:57
@jvega190 jvega190 requested a review from rart as a code owner June 26, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant