File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
src/block-components/icon Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,8 @@ export const Icon = props => {
184184
185185 const ShapeComp = useMemo ( ( ) => getShapeSVG ( getAttribute ( 'backgroundShape' ) || 'blob1' ) , [ getAttribute ( 'backgroundShape' ) ] )
186186
187+ const iconColorType = getAttribute ( 'iconColorType' )
188+
187189 const _icon = value || getAttribute ( 'icon' )
188190 const currentIconRef = useRef ( _icon )
189191 const processedIconRef = useRef ( null )
@@ -204,7 +206,14 @@ export const Icon = props => {
204206
205207 // Don't use page icons for multicolor icons
206208 // because we target svg elements with the :nth-of-type() selector to apply the multicolor styles.
207- if ( getAttribute ( 'iconColorType' ) === 'multicolor' ) {
209+ if ( iconColorType === 'multicolor' ) {
210+ // Clean up if this icon was previously in the page-icons store
211+ if ( processedIconRef . current === _icon && _icon ) {
212+ dispatch ( 'stackable/page-icons' ) . removePageIcon ( _icon )
213+ processedIconRef . current = null
214+ setIcon ( _icon ) // Use the original icon directly
215+ lastIconValueRef . current = _icon
216+ }
208217 return
209218 }
210219
@@ -288,7 +297,7 @@ export const Icon = props => {
288297 lastIconValueRef . current = null
289298 }
290299 }
291- } , [ _icon ] )
300+ } , [ _icon , iconColorType ] )
292301
293302 useEffect ( ( ) => {
294303 return ( ) => {
You can’t perform that action at this time.
0 commit comments