Open Profesor08 opened 5 months ago
I've just downloaded the repo and couldn't reproduce this issue.
It is something weird. May be this behavior happens because of the way how file is included <use href={
/icons.svg#check_box}></use>
? Or may be some additional headers are required to make this to work?
There is video how it looks
https://github.com/vercel/next.js/assets/8218016/2bddb745-6491-4bdc-82ab-a8656460cff5
trashed
The fill
attribute set on the <use>
element within our SVG was not updating as expected, causing the icons to retain their original color despite changes. This was due to the fact that the SVG symbols had hardcoded fill
attributes which were not overridden by the fill
attributes set on the <use>
elements.
SVG Symbol Update:
fill
attributes from the paths inside the <symbol>
elements in icons.svg
.currentColor
for stroke
and fill
attributes within the symbol definitions. This allows the color to be inherited from the parent SVG element.Component Update
:
fill
color directly to the <use>
element via inline styles or CSS classes to ensure proper inheritance of the color.currentColor
: By setting stroke
and fill
attributes to currentColor
, the SVG paths will inherit the color from the parent element, allowing dynamic color changes through CSS or inline styles.These changes collectively ensure that the SVG icons update their colors dynamically as intended, providing a more flexible and maintainable solution.
@despino-streaver @Profesor08
@Avik-creator using currentColor
does nothing, because the issue is not about the coloring icons, but about entire svg, it is somehow cached and not updating. To check this, just add one new icon to it.
Adding additional random query parameters is weird and adds additional overhead in development. Updating svg file must be enough, because browser checks provided cache and etag headers to make a decision.
Ok will look into it once again.
May be it is related to chrome issue: https://issues.chromium.org/issues/353259715
Currently I didn't find any satisfying workaround
May be it is related to chrome issue: https://issues.chromium.org/issues/353259715
Currently I didn't find any satisfying workaround
In my case that was the issue,
option 1: my temporary work-around is to give names to icons according to styles, if you need orange and green icon just create both svg style them and swicth to one or the other,
option 2: stop using
this should be fixed soon anyway !
Link to the code that reproduces this issue
https://stackblitz.com/edit/stackblitz-starters-dwwset
To Reproduce
/public/icons.svg
Current vs. Expected behavior
Current behavior:
Expected behavior:
Provide environment information
Which area(s) are affected? (Select all that apply)
Developer Experience, Image (next/image)
Which stage(s) are affected? (Select all that apply)
next dev (local), next start (local)
Additional context
I have disabled cache in browser (
Network/disable cache
). The only way to force update is to stop dev server, delete content of.next
folder, and to start server again