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

Emit sl-error in sl-icon for failing requests #326

Merged
merged 1 commit into from Feb 10, 2021
Merged

Emit sl-error in sl-icon for failing requests #326

merged 1 commit into from Feb 10, 2021

Conversation

ibirrer
Copy link
Contributor

@ibirrer ibirrer commented Feb 9, 2021

Listening to the sl-error event of sl-icon is not triggered if the request to the svg fails. Example

<sl-icon id="triangle" name="exclamation-triangle"></sl-icon>
<sl-icon id="missing"  name="missing"></sl-icon>

<script>
  // works fine
  document.getElementById("triangle").addEventListener("sl-load", () => console.log("loaded"))
  // never triggered
  document.getElementById("missing").addEventListener("sl-error", (e) => console.log("error", e))
</script>

This PR fixes this by emitting the event if file.ok is false.

@vercel
Copy link

vercel bot commented Feb 9, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/shoelace/shoelace/c4x8su1aa
✅ Preview: https://shoelace-git-fork-ibirrer-sl-error-on-status-error.shoelace.vercel.app

@claviska claviska merged commit 58b4b39 into shoelace-style:next Feb 10, 2021
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.

None yet

2 participants