Skip to content

Comments

Remove $.ajax usage, add lorisFetch wrapper, and drop ajax-dependent vendor libs#10327

Closed
Montekkundan wants to merge 3 commits intoaces:mainfrom
Montekkundan:montek/issue-4213-fetch-api
Closed

Remove $.ajax usage, add lorisFetch wrapper, and drop ajax-dependent vendor libs#10327
Montekkundan wants to merge 3 commits intoaces:mainfrom
Montekkundan:montek/issue-4213-fetch-api

Conversation

@Montekkundan
Copy link

@Montekkundan Montekkundan commented Feb 5, 2026

Summary

  • Replacec remaining $.ajax calls with fetch and a new lorisFetch wrapper.
  • Centralize 401/login handling so session expiry prompts are consistent.
  • Remove ajax-dependent vendor bundles (autocomplete + webshims).

Why

  • Replace jQuery $.ajax with the javascript fetch API #4213 priority: jQuery should not be a dependency; $.ajax was a primary blocker.
  • A small wrapper keeps 401/login behavior consistent without duplicating logic.
  • lorisFetch centralizes 401/login modal behavior so all fetch calls handle session expiry consistently.

What changed

  • Added jslib/lorisFetch.js and wired it into global usage.
  • Replaced ajax usage across candidate_parameters, dqt, configuration, statistics, user_accounts, document_repository.
  • Removed htdocs/js/jquery/jquery.autocomplete.js, htdocs/js/shims/*, and modules/brainbrowser/js/html5-minc-viewer.min.js.

Scope note

This PR removes $.ajax usage and ajax‑dependent vendor libs only.
Other jQuery usages remain and should be handled in a separate refactor.

Verification

  • rg "\$\.ajax|\$\.get|\$\.post" returns no matches.

Tests

  • npm run lint:js (warnings only, no errors)
  • npm run build (warnings about bundle size; build succeeds)

@github-actions github-actions bot added Language: Javascript PR or issue that update Javascript code Module: statistics PR or issue related to statistics module Module: dqt PR or issue related to (old) dqt module Module: brainbrowser PR or issue related to brainbrowser module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: document_repository PR or issue related to documen_repository module Module: user_accounts PR or issue related to the user_accounts module labels Feb 5, 2026
@driusan
Copy link
Collaborator

driusan commented Feb 5, 2026

Can you please split this up into multiple PRs that each do one thing and can be reviewed independently?

A good set of PRs would be:

  1. One that removes the files that you're removing
  2. One that adds the "lorisfetch" that you've created
  3. One per module that uses it

There seems to be changes unrelated to $.ajax in this PR as well (ie. .fadeTo) that should also be separated.

@Montekkundan
Copy link
Author

Montekkundan commented Feb 5, 2026

Closing this PR in favor of split PRs, as requested.

Opened:

  1. Remove ajax-dependent vendor bundles (webshims + autocomplete + minc viewer) Remove ajax-dependent vendor bundles (webshims + autocomplete + minc viewer) #10332
  2. Add lorisFetch wrapper for centralized 401/login handling Add lorisFetch wrapper for centralized 401/login handling #10333
  3. candidate_parameters: replace $.ajax with lorisFetch candidate_parameters: replace $.ajax with lorisFetch #10334
  4. dqt: replace $.ajax with lorisFetch dqt: replace $.ajax with lorisFetch #10335
  5. configuration: replace $.ajax with lorisFetch configuration: replace $.ajax with lorisFetch #10336
  6. document_repository: replace $.ajax with lorisFetch document_repository: replace $.ajax with lorisFetch #10337
  7. statistics: replace $.ajax with lorisFetch statistics: replace $.ajax with lorisFetch #10338
  8. user_accounts: replace $.ajax with lorisFetch user_accounts: replace $.ajax with lorisFetch #10339

Notes:

  • Each module PR is scoped to $.ajax replacement for that module only.
  • Unrelated changes (.fadeTo) are excluded from these module AJAX PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language: Javascript PR or issue that update Javascript code Module: brainbrowser PR or issue related to brainbrowser module Module: candidate_parameters PR or issue related to candidate_parameters module Module: configuration PR or issue related to configuration module Module: document_repository PR or issue related to documen_repository module Module: dqt PR or issue related to (old) dqt module Module: statistics PR or issue related to statistics module Module: user_accounts PR or issue related to the user_accounts module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants