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

Fix callback already called #28

Merged
merged 4 commits into from
May 21, 2024

Conversation

jvoccia
Copy link
Contributor

@jvoccia jvoccia commented May 18, 2024

Description

Callbacks were being called multiple times causing incorrect messages in WebPack. Also, if an SVG file was invalid the code was marking the SVG file for processing resulting in some pretty ugly errors when calculating etags.

Fixes: #27

Specific Changes proposed

Reordered pre-conditions checks towards the top of loader.ts. Returned when the callback was called, instead of letting it "fall through", updated tests to catch issue, and ran Prettier.

Requirements Checklist

  • Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Docs/guides updated
    • Example created on CodePen
  • Reviewed by contributors

If you call multiple callbacks from the loader, the error:
Error: callback(): The callback was already called.
Will appear.  Return early for pre-condition callbacks instead 
so appropriate error appears in console.
It is not processed by the Plugin.
Copy link

stackblitz bot commented May 18, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@yoriiis
Copy link
Owner

yoriiis commented May 21, 2024

Thanks @jvoccia for the issue and the PR 👍🏻

@yoriiis yoriiis merged commit 716262d into yoriiis:main May 21, 2024
11 checks passed
@yoriiis
Copy link
Owner

yoriiis commented May 21, 2024

The fix is available in the 6.0.1 🎉

@jvoccia jvoccia deleted the fix-callback-already-called branch May 21, 2024 21:55
@jvoccia
Copy link
Contributor Author

jvoccia commented May 21, 2024

Thanks @yoriiis!

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.

Error conditions are not shown when loader fails
2 participants