fix (global colors): add modified indicator#3586
Conversation
WalkthroughIntroduces reading stackable/global-colors from settings and passes a computed showModifiedIndicator prop to PanelAdvancedSettings in the global colors inspector. Uses optional chaining to safely detect existing custom colors. No public API changes. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant G as GlobalColorsInspector
participant S as Settings (getSettings)
participant P as PanelAdvancedSettings
U->>G: Open Global Colors
G->>S: getSettings()
S-->>G: { stackable: { global-colors: [...] } }
G->>G: compute showModifiedIndicator = !!stackableColors?.length
G->>P: render with showModifiedIndicator
note over P: Indicator visible when colors exist
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNone found. Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
🤖 Pull request artifacts
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/plugins/global-settings/colors/index.js (1)
116-116: Nit: preferlength > 0over!!lengthfor clarity; optionally include toggle changesCurrent logic is fine; this just improves readability. Optionally, include the hide-toggles to mark any panel change as “modified”.
Apply one of the following:
- showModifiedIndicator={ !! stackableColors?.length } + showModifiedIndicator={ stackableColors?.length > 0 }Optional (consider any non-default toggle as modified too):
- showModifiedIndicator={ !! stackableColors?.length } + showModifiedIndicator={ + (stackableColors?.length > 0) || + hideThemeColors || hideDefaultColors || hideSiteEditorColors + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
src/plugins/global-settings/colors/index.js(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: PHP 8.2 and WP 6.7.2
- GitHub Check: PHP 7.3 and WP 6.5.5
- GitHub Check: PHP 8.2 and WP 6.5.5
- GitHub Check: PHP 8.2 and WP latest
- GitHub Check: PHP 8.2 and WP 6.6.2
- GitHub Check: PHP 7.3 and WP latest
🔇 Additional comments (1)
src/plugins/global-settings/colors/index.js (1)
73-77: Global Settings:stackableColorsAlready Defaults to an Empty Array
- The
stackable/global-colorsstore’s DEFAULT_STATE and its resolver both ensurestackableColorsis always defined as an array (default[]).- There is no separate
getStackableColors()selector—custom colors live undergetSettings().stackableColorsas expected.PanelAdvancedSettingsaccepts theshowModifiedIndicatorprop (defaulted tofalsein its implementation and overridden here via!! stackableColors?.length).No changes needed—the existing store defaults and selector shape guarantee safety.
fixes #3576
Summary by CodeRabbit