Skip to content

[7096] XB does not inform or block the author when an item is in System processing state#4796

Open
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:bugfix/7096
Open

[7096] XB does not inform or block the author when an item is in System processing state#4796
jvega190 wants to merge 2 commits intocraftercms:developfrom
jvega190:bugfix/7096

Conversation

@jvega190
Copy link
Member

@jvega190 jvega190 commented Feb 11, 2026

craftercms/craftercms#7096

Summary by CodeRabbit

  • New Features

    • Experience builder now shows "System processing" in zone markers when content is being processed, replacing the generic "Not editable" message for clearer feedback.
  • Improvements

    • Content item state is now propagated into zone markers for more accurate UI status.
    • Edit availability checks use the resolved content item state, improving reliability of editability indicators.

@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

Walkthrough

Adds getContentItemFromRecord to resolve ContentItem from an element record, updates isEditActionAvailable to use it, and propagates the resolved content item's stateMap from ExperienceBuilder into ZoneMarker to surface a systemProcessing indicator in the UI.

Changes

Cohort / File(s) Summary
Utility Function & API
ui/guest/src/utils/util.ts
Adds exported getContentItemFromRecord(...) to compute a content item path from a record (with parent-model fallback) and return the ContentItem; refactors isEditActionAvailable to delegate to this helper.
Experience Builder
ui/guest/src/react/ExperienceBuilder.tsx
Imports and uses getContentItemFromRecord to obtain contentItem, extracts itemStateMap from contentItem?.stateMap, and passes it as stateMap prop to ZoneMarker.
ZoneMarker component
ui/guest/src/react/ZoneMarker.tsx
Accepts new optional stateMap?: ItemStateMap prop, computes isSystemProcessing from stateMap?.systemProcessing, and displays "System processing" when true (instead of only "Not editable").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 1 | ❌ 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.
Description check ❓ Inconclusive The description only contains a ticket link with no additional details about the changes, objectives, testing, or implementation approach. Expand the description to explain what changes were made, why they were made, how the system processing state is now handled, and any testing performed.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly references the ticket ID [7096] and accurately summarizes the main change: informing and blocking authors when an item is in System processing state.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉


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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@ui/guest/src/react/ZoneMarker.tsx`:
- Line 69: Make the stateMap prop optional on ZoneMarker by changing its prop
type so stateMap?: ItemStateMap (update the ZoneMarker component/interface where
stateMap is declared) and ensure any internal uses of stateMap in ZoneMarker
(e.g., lookups or methods that assume it's present) guard for undefined or use a
safe default; this aligns with ExperienceBuilder passing contentItem?.stateMap
(from getContentItemFromRecord) which can be undefined.

In `@ui/guest/src/utils/util.ts`:
- Around line 62-63: The function is returning
contentItem?.availableActionsMap.edit which can be undefined while the signature
promises boolean; update the caller in util.ts to coerce the value to a true
boolean (e.g., use Boolean(...) or !!) so the return type is always boolean, and
also adjust getContentItemFromRecord (its implementation/signature) to
consistently return undefined (not null) when a path is missing so callers
handle absence uniformly; reference getContentItemFromRecord and
availableActionsMap.edit when making these changes.
🧹 Nitpick comments (1)
ui/guest/src/react/ExperienceBuilder.tsx (1)

649-676: Duplicated getContentItemFromRecord lookup — consider calling it once.

isEditActionAvailable (line 649) internally calls getContentItemFromRecord with the same arguments you pass again on line 670. You can avoid the double lookup by calling getContentItemFromRecord once and deriving both values:

♻️ Suggested refactor
-							const isEditable = isEditActionAvailable({
-								record: elementRecord,
-								models: getCachedModels(),
-								contentItemsByPath: getCachedContentItems(),
-								parentModelId: getParentModelId(elementRecord.modelId, getCachedModels(), modelHierarchyMap)
-							});
+							const contentItem = getContentItemFromRecord({
+								record: elementRecord,
+								models: getCachedModels(),
+								contentItemsByPath: getCachedContentItems(),
+								parentModelId: getParentModelId(elementRecord.modelId, getCachedModels(), modelHierarchyMap)
+							});
+							const isEditable = contentItem?.availableActionsMap.edit;
 							let zoneMarkerModeStyles: Record<string, SxProps<Theme>>;
 							...
-							const contentItem = getContentItemFromRecord({
-								record: elementRecord,
-								models: getCachedModels(),
-								contentItemsByPath: getCachedContentItems(),
-								parentModelId: getParentModelId(elementRecord.modelId, getCachedModels(), modelHierarchyMap)
-							});
 							const itemStateMap = contentItem?.stateMap;

@jvega190 jvega190 marked this pull request as ready for review February 11, 2026 17:49
@jvega190 jvega190 requested a review from rart as a code owner February 11, 2026 17:49
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

Comments