Skip to content

fix(@angular/build): invalidate inline stylesheet load cache when component file changes - #34438

Draft
alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:fix/component-stylesheets-cache
Draft

alan-agius4 wants to merge 2 commits into
angular:mainfrom
alan-agius4:fix/component-stylesheets-cache

Conversation

@alan-agius4

@alan-agius4 alan-agius4 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

When an inline stylesheet's containing .ts file is modified, ComponentStylesheetBundler.invalidate() previously deleted entry from #inlineContexts and disposed its BundlerContext without invalidating #loadCache.

  • Always invalidate #loadCache for angular:styles/component:${entry} when deleting entry from #inlineContexts as well as for all normalizedFiles.
  • Allow MemoryLoadResultCache.invalidate() to directly evict cache keys in #loadResults.
  • This ensures inline SCSS @use errors recover when a missing partial is created, inline template Tailwind utility changes invalidate cached inline styles, and obsolete angular:styles/component:${entry} keys are evicted.

…ort persistent cache

Ensure `ComponentStylesheetBundler.invalidate()` always invalidates `#loadCache` for all modified files, including evicting `angular:styles/component:${entry}` keys when an inline stylesheet's containing component `.ts` file is invalidated. Previously, invalidating a component `.ts` file deleted the inline `BundlerContext` without invalidating `#loadCache`, leaving stale errors (such as missing `@use` partials), stale Tailwind utility CSS, and unreferenced inline stylesheet entries in memory.

Additionally, allow `ComponentStylesheetBundler` to accept an optional `LoadResultCache` and wire `PersistentLoadResultCache` in `createComponentStylesheetBundlerForLibrary` when persistent disk caching is enabled.
@alan-agius4 alan-agius4 changed the title fix(@angular/build): invalidate inline stylesheet load cache and support persistent cache fix(@angular/build): invalidate inline stylesheet load cache when component file changes Oct 20, 2026
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.

1 participant