[7096] XB does not inform or block the author when an item is in System processing state#4796
[7096] XB does not inform or block the author when an item is in System processing state#4796jvega190 wants to merge 2 commits intocraftercms:developfrom
Conversation
…em processing state
WalkthroughAdds 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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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: DuplicatedgetContentItemFromRecordlookup — consider calling it once.
isEditActionAvailable(line 649) internally callsgetContentItemFromRecordwith the same arguments you pass again on line 670. You can avoid the double lookup by callinggetContentItemFromRecordonce 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;
…lways returns boolean
craftercms/craftercms#7096
Summary by CodeRabbit
New Features
Improvements