-
Notifications
You must be signed in to change notification settings - Fork 321
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 wrong switcher JSON loaded for dev docs #2048
base: main
Are you sure you want to change the base?
Conversation
// Assume we got a relative path, and fix accordingly. This also handles local | ||
// static sites (i.e., when window.location.protocol == 'file:'). Normally for | ||
// local static sites CORS policy will always block resource requests, so in | ||
// general the version switcher will always fail to populate if you just open up | ||
// the built HTML files (instead of spinning up a local server). Here instead of | ||
// returning `null` we work out what the file path would be anyway (same code path | ||
// as for served docs), as a convenience to folks who routinely disable CORS when | ||
// they boot up their browser. |
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.
FYI @dstansby, since you left the TODO item that I'm now removing.
// assume we got a relative path, and fix accordingly. But first, we need to | ||
// use `fetch()` to follow redirects so we get the correct final base URL |
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.
this comment about using fetch()
to follow redirects is something I'm now effectively ignoring. @12rambau do you recall the corner case that led to adding this?
|
||
1. View the locally-built files through a local webserver (Python provides a builtin module for this: https://docs.python.org/3/library/http.server.html). | ||
2. Disabling your browser's security settings (either by passing a command-line flag when launching the browser, or through a browser add-on). | ||
|
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.
Should we print that, or a link to that in the console when we see the file://
protocol ?
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 considered doing a console.log but then I thought: pointing folks to this docs page is way easier than explaining how to view browser console. So to me seemed not worth it but I don't mind adding it if you think is
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.
Oh wait I misunderstood you. You're thinking about folks who already are checking browser console when something goes wrong. Yeah, probably worth adding it for their benefit
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.
Yes, that's what I meant.
I was also going to point out, if we detect this we could literally fill the version switcher itself with this text; but that may be overkill.
+1 to merge, we can wait a few hours to get a chance to have @12rambau reply on your questions. |
closes #2035