-
Notifications
You must be signed in to change notification settings - Fork 190
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: ignore requests to /_favicon/ #819
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 4125df7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for figuring this out! 💯 I requested a small change.
if (url.href.includes('/_favicon/')) { | ||
const response = await fetch(url.href) | ||
return new Response(response.body, { | ||
headers: { | ||
'Content-Type': response.headers.get('Content-Type') ?? 'text/javascript', | ||
}, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine there are other use cases to not redirect to the dev server, so I think it's best if we handle all this in one place. What if we move url.href.includes('/_favicon/')
up into line 23 and abstract it into a guard function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, I put them in a array const ignoreURLPaths = ['/_favicon/']
, in case there are other paths to ignore as well (also perhaps allow users to add their own ignore paths). It's not as efficient as doing separate if statements as before (though V8 is probably optimizing these on its own), but as I mentioned in the future users might want to add other ignore paths?
* fix: hmr error * Create bright-peaches-wink.md --------- Co-authored-by: Jack Steam <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes #618