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 wrong switcher JSON loaded for dev docs #2048

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

drammock
Copy link
Collaborator

closes #2035

Comment on lines 415 to 422
// 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.
Copy link
Collaborator Author

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.

Comment on lines -422 to -423
// 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
Copy link
Collaborator Author

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?

Copy link

Coverage report

This PR does not seem to contain any modification to coverable code.


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).

Copy link
Collaborator

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 ?

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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

Copy link
Collaborator

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.

Carreau
Carreau previously approved these changes Nov 21, 2024
@trallard trallard added the kind: bug Something isn't working label Nov 21, 2024
@Carreau
Copy link
Collaborator

Carreau commented Nov 22, 2024

+1 to merge, we can wait a few hours to get a chance to have @12rambau reply on your questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest version on RTD button goes to 0.15.4
3 participants