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

Error: e.map is not a function #1723

Closed
dstansby opened this issue Feb 17, 2024 · 5 comments
Closed

Error: e.map is not a function #1723

dstansby opened this issue Feb 17, 2024 · 5 comments

Comments

@dstansby
Copy link
Contributor

I'm trying to get an up to date version of pydata-sphinx-theme working with Matplotlib (matplotlib/matplotlib#27658). With the current main branch of pydata-sphinx-theme search/theme changing/version switching isn't working, and I think this is because of the javascript error we're getting,

Uncaught (in promise) TypeError: e.map is not a function
    g https://output.circle-artifacts.com/output/job/65bed756-88de-4a26-93f0-3d06e9d8950f/artifacts/0/doc/build/html/_static/scripts/pydata-sphinx-theme.js?digest=2f715a4ca1682955a1c0:1
    937 https://output.circle-artifacts.com/output/job/65bed756-88de-4a26-93f0-3d06e9d8950f/artifacts/0/doc/build/html/_static/scripts/pydata-sphinx-theme.js?digest=2f715a4ca1682955a1c0:1
[pydata-sphinx-theme.js:1:4657](https://output.circle-artifacts.com/output/job/65bed756-88de-4a26-93f0-3d06e9d8950f/artifacts/0/doc/build/html/_static/scripts/pydata-sphinx-theme.js?digest=2f715a4ca1682955a1c0)

The code that is triggering this is

const n=(e=e.map((e=>(e.match=e.version==DOCUMENTATION_OPTIONS.theme_switcher_version_match,e.preferred=e.preferred||!1,"name"in e||(e.name=e.version),e)))).map((e=>e.preferred&&e.match)).some(Boolean)

It looks like this is some minified(???) javascript, so I'm not sure how to proceed with debugging. Any pointers welcome (is there a way to turn off the squashing of all the javascript into one line?)

A doc build that has this error is here: https://output.circle-artifacts.com/output/job/65bed756-88de-4a26-93f0-3d06e9d8950f/artifacts/0/doc/build/html/index.html

@drammock
Copy link
Collaborator

Looks like here:

https://github.com/pydata/pydata-sphinx-theme/blob/99f9b1c29854ee0f88884e032acc1997dfae370e/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js#L386-399

I'm away for the next week or so, so can't be of much help right away, but maybe seeing the unminified version will be enough for you to figure it out without me 🤞

@QuLogic
Copy link
Contributor

QuLogic commented Feb 21, 2024

This is because the version switcher appears to be trying to load https://output.circle-artifacts.com/_static/switcher.json which is obviously going to not work. Has the option for the version switcher URL changed?

There's an if (data) { around the caller to populateVersionSwitcher, but it appears that's not a sufficient condition?

@MridulS
Copy link
Contributor

MridulS commented Jun 3, 2024

I tried to recreate this issue, but it seems to work?

From one of the recent builds on matplotlib https://output.circle-artifacts.com/output/job/6954838a-52ab-43ed-8fcc-ddfb47b50117/artifacts/0/doc/build/html/index.html, I can pick a version. It just redirects me to an old build like https://matplotlib.org/3.8.4/

The javascript error is still in the console, but not sure if that's causing the issue.

@dstansby
Copy link
Contributor Author

dstansby commented Jun 5, 2024

Yeah, I think worth closing if noone else can easily reproduce. I can't either, can always re-open if I run across it again.

@dstansby dstansby closed this as not planned Won't fix, can't repro, duplicate, stale Jun 5, 2024
@QuLogic
Copy link
Contributor

QuLogic commented Jun 5, 2024

I think the original error was fixed by matplotlib/matplotlib#27658, which pointed the switcher to the correct path on CircleCI. If you curl https://output.circle-artifacts.com/_static/switcher.json, then you get {"message":"Route Not Found"}, which is valid JSON, but just not at all in the format expected of the version switcher data.

I'm not sure why there's still a warning in the console, but it appears that it's a different error? It looks like Uncaught (in promise) TypeError: e is null.

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

No branches or pull requests

4 participants