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/more typeahead fails #3065

Merged
merged 2 commits into from
Nov 18, 2023
Merged

fix/more typeahead fails #3065

merged 2 commits into from
Nov 18, 2023

Conversation

henrikhorluck
Copy link
Member

  • Ensure typeahead jQuery extensions are loaded
  • Remove scrollspy-ing

We have at least the following jQuery versions in use:

1. `2.2.4` supplied from NPM, esbuild includes it in the chunks we later
   load.
2. `2.2.4` supplied from a script-tag in (dashboard)-base (with fallback to
   now defunct self-hosted static file).
    - This is the "global" jQuery most of the time.
3. `3.1.1` in use in templates/dashboard/events/details.html
4. `3.2.1` for django-wiki in templates/wiki/base.html

On most of dashboard the global 2.2.4 is in use, not the one from NPM.

It appears that the typeahead library has its own way of finding out
_which_ global jQuery version it should apply to. Since esbuild is set
to output in [ESM-format](https://esbuild.github.io/api/#format-esm),
it does some transformation of CommonJs-code (module.exports), which
means that `require/module` is defined in the _browser_ (where we are running).

Is there a better way to fix this? Yes, remove the code and be in sync
around one version, or isolate them better. Is it worth using any more
time on this? No.

The two 2.2.4 are _different objects_ so you can end in a
situation where `jQuery === $` is `false`. That is what happens when these
imports are uncommented, since only the name imported is the one changed
to the NPM-supplied version.

See: 6735dda,
812c7bb, 53b57b9
There is a scrollspy function in initFrontpage.js, it appears to not be
related? User-search is likely to get removed anyways.
@henrikhorluck henrikhorluck added this pull request to the merge queue Nov 18, 2023
Merged via the queue into main with commit 4b3e013 Nov 18, 2023
@henrikhorluck henrikhorluck deleted the fix/more-typeahead-fails branch November 18, 2023 18:06
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.

1 participant