Skip to content

Internal: Delete invalidated style definitions' corresponding CSS files [ED-21536]#33455

Merged
ronros-elementor merged 17 commits intoelementor:mainfrom
ronros-elementor:feature/ED-21536
Nov 17, 2025
Merged

Internal: Delete invalidated style definitions' corresponding CSS files [ED-21536]#33455
ronros-elementor merged 17 commits intoelementor:mainfrom
ronros-elementor:feature/ED-21536

Conversation

@ronros-elementor
Copy link
Copy Markdown
Contributor

@ronros-elementor ronros-elementor commented Nov 13, 2025

  • Moved cache invalidation to occur from within the Atomic_Styles_Manager, instead of directly invalidating each caching flag from its corresponding "styles provider" class.
  • Changed the atomic styles manager's API a bit, to not use the $style_key argument, which is essentially just an implode of the $cache_keys array - instead will only use the $cache_keys.
  • Added back an accidentally removed tests file (removed at ED-19458)

✨ PR Description

Purpose: Refactor style registration and cache invalidation system to improve CSS file management and deletion of invalidated styles.
Main changes:

  • Replaced string keys with path arrays for better hierarchy organization of style definitions
  • Added file deletion mechanism when invalidating cached styles via new clear_styles method
  • Implemented get_node method in Cache_Validity to traverse cache structure for targeted invalidation

Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using.
💡 Tip: You can customize your AI Description using Guidelines Learn how

@ronros-elementor ronros-elementor marked this pull request as ready for review November 16, 2025 09:02
Omerisra6
Omerisra6 previously approved these changes Nov 17, 2025
$this->post_ids[] = $post_id;
} );

add_action( 'elementor/atomic-widgets/styles/clear', fn( array $cache_keys ) => $this->clear_styles( $cache_keys ) );
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.

I liked the name $path better, but maybe it won't make sense for the end user? (in other places as well)

Comment on lines +531 to +539
$upload_dir = wp_upload_dir();
$base_path = trailingslashit( $upload_dir['basedir'] ) . 'elementor/css/';

$existing_files = [
$base_path . implode( '-', $nested_cache_key_1 ) . '-desktop.css',
$base_path . implode( '-', $nested_cache_key_1 ) . '-mobile.css',
$base_path . implode( '-', $nested_cache_key_2 ) . '-desktop.css',
$base_path . implode( '-', $nested_cache_key_2 ) . '-tablet.css',
];
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.

maybe put it at the top so it would be clearer

@ronros-elementor ronros-elementor added this pull request to the merge queue Nov 17, 2025
Merged via the queue into elementor:main with commit faf3fef Nov 17, 2025
40 checks passed
@ronros-elementor ronros-elementor deleted the feature/ED-21536 branch November 17, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants