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

fallback to initials if the image is not loaded (#40) #64

Merged
merged 1 commit into from
May 25, 2020
Merged

fallback to initials if the image is not loaded (#40) #64

merged 1 commit into from
May 25, 2020

Conversation

danielbprice
Copy link
Contributor

Also, fix the version of vue-test-utils to 1.0.0-beta.20 to protect from breaking changes

@saintplay
Copy link
Collaborator

Hi, interesting solution, did you take this pattern from somewhere?

@danielbprice
Copy link
Contributor Author

Yes, the technique is based on information I found here: https://stackoverflow.com/questions/5057990/how-can-i-check-if-a-background-image-is-loaded

@danielbprice
Copy link
Contributor Author

I think another possibility would be to use something like https://github.com/desandro/imagesloaded ; based on my very quick read of its code (and I am not an expert) it does something somewhat similar-- creating a new Image() and then attaching events to that, although it is has more features and is battle tested across multiple browsers. It might be overkill for this application. I definitely didn't know how you would feel about adding a dependency.

@andreasvirkus
Copy link
Contributor

@saintplay would you consider merging this?

@saintplay
Copy link
Collaborator

I didn't have time to try this. @andreasvirkus can you confirm if this works?

@danielbprice
Copy link
Contributor Author

(I'm still here and happy to adjust this PR if there is review feedback)

package.json Outdated Show resolved Hide resolved
@andreasvirkus
Copy link
Contributor

andreasvirkus commented May 15, 2020

@saintplay Checked it out and it seems to work great and not break any behaviour. You can see that the luke-skywalker.png is not found but the initials are still displayed.

Screenshot 2020-05-15 at 11 27 48

@danielbprice i've added a minor comment and a question to your PR, but otherwise really eager to see this merged 🎉

(also linking to #69)

@danielbprice
Copy link
Contributor Author

I've removed the extraneous edit to package.json (I don't know why, but I can no longer reproduce the problem with vue-test that led me to do this; perhaps I hit a window where something was broken upstream which is now fixed) and fixed the issue with the documentation noted by @andreasvirkus

Wasn't really sure if I was supposed to update the bundle, so let me know and I can strip out that change if not.

@andreasvirkus
Copy link
Contributor

LGTM @saintplay

@saintplay saintplay closed this May 17, 2020
@saintplay saintplay reopened this May 17, 2020
@saintplay
Copy link
Collaborator

@danielbprice it seems like you need to remove vue-avatar.min.js file or update your branch with git rebase

@saintplay saintplay merged commit 39d5371 into eliep:master May 25, 2020
@saintplay
Copy link
Collaborator

Sorry I'm late, I didn't get a notification.

Released in v2.3.0

@danielbprice
Copy link
Contributor Author

(Belatedly) Thank you! I appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants