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

Favicon loading is delaying extension UI #54

Closed
2 tasks
sharon-wang opened this issue Jun 13, 2020 · 3 comments · Fixed by #88
Closed
2 tasks

Favicon loading is delaying extension UI #54

sharon-wang opened this issue Jun 13, 2020 · 3 comments · Fixed by #88
Assignees
Labels
bug Something isn't working priority 3 Tertiary priority

Comments

@sharon-wang
Copy link
Member

We load the favicon image into the top site circle when the extension is opened. This can result in the image being deformed or not loaded at all. On top of that, the loading of the image can delay the loading of the extension UI itself, which is bad UX. We should cache the image or otherwise may the favicon loading more efficient.

The below problems were discovered in #48.

  • Circle shouldn't be empty

image

  • Favicon loading issue? Image stretched
    image
@vezwork
Copy link
Member

vezwork commented Dec 18, 2020

We can do image serialization (for caching) using FileReader.readAsDataURL() along with the fetch API:

async function loadImageToDataURL(url) 
  const response = await fetch(url);
  const blob = await response.blob();
  return new Promise((resolve, reject) => {
    const reader = new FileReader()
    reader.onloadend = () => resolve(reader.result);
    reader.onerror = () => reject();
    reader.readAsDataURL(blob);
  });
}

reference: https://stackoverflow.com/a/20285053/5425899 "How can I convert an image into Base64 string using JavaScript?"

@vezwork
Copy link
Member

vezwork commented Dec 18, 2020

#88 Fixes the issue where loading of favicon images can delay the loading of the extension UI itself.

I didn't see any deformed images during testing. I don't think I've seen a stretched favicon since the hackathon period, maybe it's no longer an issue?

Are we satisfied with the fix in #88 or do we want to also cache images so they display instantly?

@sharon-wang
Copy link
Member Author

sharon-wang commented Dec 21, 2020

I didn't see any deformed images during testing. I don't think I've seen a stretched favicon since the hackathon period, maybe it's no longer an issue?

I also haven't seen this problem since the issue was created, so I agree we can assume it's not an issue anymore.

Are we satisfied with the fix in #88 or do we want to also cache images so they display instantly?

I think the fix in #88 is sufficient to address the UX problem and caching the favicons can be a future enhancement (opened #89). I'll update the title of this issue to reflect what we're solving with the PR.

@sharon-wang sharon-wang changed the title Find way to cache favicon to avoid bad image loading UX Favicon loading is delaying extension UI Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority 3 Tertiary priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants