Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR ensures that a default no-op implementation of IMemberPartialViewCacheInvalidator is registered in headless (no-website) setups to prevent missing-service errors while allowing the real implementation to override it when .AddWebsite() is used.
- Registers
NoopMemberPartialViewCacheInvalidatorinUmbracoBuilder.AddCoreServices() - Adds a new internal no-op class under
Cache.PartialViewCacheInvalidators - Removes a duplicate
usingdirective
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs | Registers default no-op invalidator for headless setups |
| src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs | Introduces an internal no-op implementation of the cache invalidator |
Comments suppressed due to low confidence (2)
src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs:349
- Consider adding a unit or integration test to verify that in a headless setup (without .AddWebsite()), the DI container resolves
IMemberPartialViewCacheInvalidatorto the no-op implementation and does not throw when logging in.
Services.AddUnique<IMemberPartialViewCacheInvalidator, NoopMemberPartialViewCacheInvalidator>();
src/Umbraco.Core/Cache/PartialViewCacheInvalidators/NoopMemberPartialViewCacheInvalidator.cs:3
- [nitpick] It may help maintainability to add a brief XML doc comment on this class explaining its purpose and override behavior when
.AddWebsite()is used.
internal class NoopMemberPartialViewCacheInvalidator : IMemberPartialViewCacheInvalidator
Migaroez
approved these changes
Jul 8, 2025
AndyButland
added a commit
that referenced
this pull request
Jul 8, 2025
…n headless setups (#19666) * Register no-op implementation of IMemberPartialViewCacheInvalidator in headless setups. * Tidied usings. # Conflicts: # src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs
This was referenced Dec 9, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites
Resolves: #19661
Description
As the linked issue discusses, when we don't have a call to
.AddWebsite()inProgram.cs, theIMemberPartialViewCacheInvalidatorhas no registered implementation, which causes an error when logging in.This PR registers a no-op implementation of this interface that'll be overridden by the primary implementation if
.AddWebsite()is used.Testing
Setup
Program.cslike the following, so there's no front-end website but you should be able log into the backoffice.Verify that you can't before this PR is applied but you can after.
Revert to the standard setup for Umbraco with the front-end rendering, put a breaking point in
MemberPartialViewCacheInvalidator.ClearPartialViewCacheItemsand verify that the primary implementation is called when saving a member in the backoffice.