Our-Umbraco-TagHelpers icon indicating copy to clipboard operation
Our-Umbraco-TagHelpers copied to clipboard

our-svg caches the CSS class

Open drpeck opened this issue 1 year ago • 3 comments

For the same SVG I have both

<our-svg src="@Model.SiteLogo" class="foo"></our-svg>
<our-svg src="@Model.SiteLogo" class="bar"></our-svg>

With the cache turned on the class attribute is cached and 'foo' is rendered in both locations. I suggest adding the CssClass to the cache key is the simplest workaround. The ideal solution would presumably be to cache the file content rather than the HTML output.

drpeck avatar Apr 28 '23 10:04 drpeck

@drpeck do you fancy trying to solve this problem and submit a PR and update the unit tests for this scenario ?

warrenbuckley avatar May 05 '23 12:05 warrenbuckley

Is the preferred approach to add the class to the cache key? That will resolve this issue, but I suspect that the issue may exist for all attributes (e.g. <our-svg src="@Model.SiteLogo" id="logo"></our-svg>). Ideally the file contents would be cached and the rendering of the tag would not be, but that looks like a much bigger change.

drpeck avatar May 16 '23 09:05 drpeck

Happy to any solutions or ideas you have for this @drpeck

warrenbuckley avatar May 16 '23 10:05 warrenbuckley