Skip to content

Conversation

@Zales0123
Copy link

Q A
Bug fix? yes
New feature? no
Deprecations? no
Documentation? no
Issues
License MIT

Hello 👋 First of all, thank you for amazing SymfonyUX initiative, it definitely brings a frash air in working with front-end for a total FE noobs like me 😅

I've recently encountered a rather unusual problem while playing in icons, still a pretty annoying one. I was coding in a plane and for some reason decided clear my cache. It resulted in a situation, when I had no icons information loaded in cache and they could not be fetched from the remote server as I had no internet connection ✈️ It resulted in 500 error and not being able to use my application just because of the missing icons 😅 I believe such a situation should be handled by default and unablity to show icons should not break the application.

I propose the easiest possible solution - catching the TransportException on the high level in the UXIconRuntime. However, I suppose it could be done nicer, to not expose any registry specific information (in the end, only the IconifyOnDemandRegistry could result in such error) - maybe we should handle it in the registry itself, and throw some more generic exception, like IconsNotAvailableException? Or maybe even use the existing IconNotFoundException? 🤔 I didn't want to push any of these solutions, and would prefer to see the opinion of the library maintainers 🫡

@carsonbot carsonbot added Bug Bug Fix Icons Status: Needs Review Needs to be reviewed labels Oct 20, 2025
@Kocal
Copy link
Member

Kocal commented Oct 20, 2025

Hi Mateusz, by any chance were you at the Sylius Con in Lyon this last friday? :)

About your changes, I already faced the same issue when working on a train/plane, where the connection was really bad and icons were not locked (ie #3084).

Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI failures seem unrelated

EDIT: posted at zenstruck/foundry#1011 (comment)

Comment on lines +49 to 53
} catch (TransportException $e) {
$this->logger?->warning($e->getMessage());

return '';
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could merge this block with the catch (IconNotFoundException $e)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The question is - should it be handled only if the ignoreNotFound flag is set to true, or it should work this way no matter what 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be handled only if the ignoreNotFound flag is set to true

IMO, yes

Copy link
Author

@Zales0123 Zales0123 Oct 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you, @Kocal 🖖 From my perspetive, a decision of not failing on not found icons is a consious choice: "if I define an unknown icon it should not fail" and in fact is an opt-in. On the other hand, not failing the application when something completely independent of the developer happens (like the internet connection problems) should be a default behaviour (or maybe opt-out 🤷).

Anyway, if you decide to cover this with the existing flag-based approach, I'm ok with that 🫡 but maybe in such a situation we should indeed just handle the TransportException in IconifyOnDemandRegistry and throw IconNotFoundException so no changes in the runtime service is needed. Again - up to you, I'm just a humble developer that found a bug 😄

Copy link
Member

@Kocal Kocal Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion I find it ridiculous that an app could returns a 500 if a single icon was not able to be downloaded on-the-fly (implying the icon was not imported/locked during development or deployment).

Your addition is nice (we still need to merge the 2 catch), however I think the DX could be improved.
I wasn't aware about this option, and I think some people too, but IMHO it would be nice to add a new Symfony Recipe for UX Icon with:

  • the option set to false true, so we make it explicit
  • the option set to true false in when@dev

Do you want to work on it? I can help you if you need.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the option set to false, so we make it explicit
the option set to true in when@dev

IMO, ignoreNotFound should be true to prevent production to return a 500 when an icon is missing.
And false in when@dev

This is why that option was originally added: #2008

Copy link
Member

@Kocal Kocal Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes indeed, I forgot what was the option name, but yes these errors should be silent in prod. I updated my message.

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Oct 20, 2025
@Zales0123
Copy link
Author

Hi Mateusz, by any chance were you at the Sylius Con in Lyon this last friday? :)

Indeed I was there 😅

CI failures seem unrelated

Of course I had the bad luck opening the PR just after some dependencies updates break the build 😆

@Kocal Kocal added Status: Needs Work Additional work is needed and removed Status: Reviewed Has been reviewed by a maintainer labels Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Bug Fix Icons Status: Needs Work Additional work is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants