-
Notifications
You must be signed in to change notification settings - Fork 591
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
Bad user experience with the icons #1188
Comments
Damn I do not like your tone dear @Neo-Zhixing, small reminder that all the tools you are using to make your website are completely free AND open source, so a thank you to start is more than welcome.
Did you look at the code before pretending that it is an easy fix to do?
If you take a look at the playground: https://stackblitz.com/edit/nuxt-icon-playground?file=app.vue You will notice that no call to Iconify API is done and everything is inlined during SSR. The main issue of I do plan to add a way to preload the icons in the future for |
Umm I do want to point out that, the reason I'm complaining about the problems with the icon solution in And As a paying customer, I'm not expecting 7x24 support but I do think that I should be able to complain about product usability. Customer stories like this one can help improve your product by allowing the developers to better understand user needs. They also serve as a guidance for future customers so they can form a more informed purchase decision.
That contradicts what I'm hearing from @benjamincanac 's statement regarding how this design decision was made. #267 (comment)
I recognize that the icons are preloaded during SSR. However, what I was suggesting is that "the icons should be available as soon as the page loads." The problem we have now is that during client-side navigation the icons may not load immediately, and that produces disturbing results like this: What
All we need is icon loads blocking page navigation. That solves 99% of the problem by avoiding sudden layout changes, and it should be both easier and less intrusive to the developer experience. While I recognize that no bug fix is easy, design decisions like "introducing another dependency that does the same thing as the current solution but differently" should not be made lightly and they should be well justified and weighted against other solutions. Icon preloading is a nice to have because when you know all the values an icon may take on, all variants can be loaded at page load so that when the icon name attribute changes the icons will be able to load immediately. However, that does not take away from the immediate bugfix we can have which is using something like |
@Neo-Zhixing What problem do you have with the default solution exactly? What is your use-case for using the |
@benjamincanac I had enabled the
import { addAPIProvider } from '@iconify/vue'
addAPIProvider('dust', {
resources: ['https://icon.my.domain'],
}) However, the CSS icon solution introduced a whole different codepath, meaning that I have to repackage all the icons and feed them to
|
As we do have an If the text is displayed, this mean that something wrong happened. Do you mind creating a small reproduction so we can help figure out the root cause? |
Should we transfer this to |
@benjamincanac Once @atinux I did some digging this weekend and it's hard to reproduce this reliably. My website was deployed on Vercel, and about 50% of the deploys never have icons prerendered while the other 50% always do. I suspect that because the I've definitively seen icons flashing as text on some nuxt official websites before, so this is a widespread but hard to reproduce problem. You'll only see it flash into text once. Subsequent requests will not have the icon prerendered but you won't notice a flash as the icons were cached. And only the timed out icons will have this flash. Presumably this is what motivated the decision to switch to In my case this phenomenon is particularly bad, because my custom icon server may require 1-2s to spin up. This would also explain why client side navigation wasn't blocked on icon loading. When server side icon fetches failed, it does so silently, but you may end up with inconsistent states between client and server leading to hydration failure. So far this is just my guess and it would be great if you can help validate this. I do not have enough context to make a judgement call on this. There are two ways to fix this:
I'll open a separate issue in nuxt-icon later. |
@Neo-Zhixing We didn't introduce |
Description
I have originally posted this as a comment here but I received no response from the maintainers. So I'm reposting this as an issue for visibility.
For context, there are currently two icon systems in nuxt/ui. One is based on tailwind css and the other is based on
nuxt-icon
. The user may switch between the two using adynamic
attribute.This is a very bad design decision. Quoting @benjamincanac here for the original reasoning behind this design decision:
So the problem we're trying to solve here is that "nuxt-icon causes icons to not instantly load", right?
And I would agree that it's a pretty bad problem. The iconify API is not the most reliable, and occasionally icons don't render on the Nuxt UI official website.
This is caused by a known issue in nuxt-icon, nuxt/icon#34 or nuxt/icon#99
Basically, nuxt-icon doesn't load the icon on the server side, and instead opt to call the iconify API from the client at all times.
So the reasonable solution to the problem of "nuxt-icon icons doesn't instantly load" would be "fix nuxt-icon so that icons can be injected and bundled at build time".
Instead of doing that, here we introduced another dependency so that icons can be injected by tailwind as a CSS icon.
What's the problem with that?
nuxt-icon
withdynamic
prop or app config #862. feat(Icon): switch to nuxt-icon with dynamic prop or app config feat(Icon): switch tonuxt-icon
withdynamic
prop or app config #862 basically falls back to the nuxt-icon component when dynamic = true. But then with that, you once again lose the ability to allow icons to load instantly, which was why egoist/tailwindcss-icons was introduced in the first place.What I'm trying to say here is that by introducing egoist/tailwindcss-icons you're significantly complicating an otherwise simple problem. Just go into nuxt-icon, help out @atinux, and fix nuxt-icon so that it can preload icons. Call useAsyncData to fetch the icons on the server side so they're available as soon as the page loads. That way you have one unified method of loading icons, instead of introducing a whole lot of mental overload for a problem as trivial as showing icons.
The text was updated successfully, but these errors were encountered: