Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue with CachedPartial that cached an unmaterialized value #10832

Merged

Conversation

bergmania
Copy link
Member

@bergmania bergmania commented Aug 11, 2021

Summary

Fixed issue with CachedPartial that did only work in cache misses.

The reason was that the value cached was un-materialized. Fix is to materialize as HtmlString before we cache.

Also changed timeout parameter from int to timespan.

Test notes

  • Create a partial view, eg hej.cshtml`
  • Use the partial view form a template: @await Html.CachedPartialAsync("hej", null, TimeSpan.FromSeconds(20))
  • Load the page (without debug mode in config)

@Zeegaan
Copy link
Member

Zeegaan commented Aug 11, 2021

Tested it, and this solution fixes the issue!

Code makes sense to me 👍

@Zeegaan Zeegaan merged commit 6be555f into v9/dev Aug 11, 2021
@Zeegaan Zeegaan deleted the v9/bugfix/cached_partial_did_not_materialize_before_caching branch August 11, 2021 12:42
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.

2 participants