Skip to content

feat: replace ng5-slider with @angular-slider/ngx-slider#58

Open
gacorpoll-ui wants to merge 3 commits into
BAWES-Universe:masterfrom
gacorpoll-ui:fix/ng5-slider-replacement
Open

feat: replace ng5-slider with @angular-slider/ngx-slider#58
gacorpoll-ui wants to merge 3 commits into
BAWES-Universe:masterfrom
gacorpoll-ui:fix/ng5-slider-replacement

Conversation

@gacorpoll-ui

@gacorpoll-ui gacorpoll-ui commented May 15, 2026

Copy link
Copy Markdown
  • Replace ng5-slider package with @angular-slider/ngx-slider
  • Update imports in component and module files
  • Update HTML template tags from ng5-slider to ngx-slider
  • Update CSS selectors in global.scss
  • Update package.json dependency
  • Run build to verify compatibility

Summary by CodeRabbit

  • Refactor
    • Replaced slider implementation across range and age filters and updated global slider styling for consistent appearance and behavior.
  • New Features
    • Search pages now render a conditional manual search UI when configuration is present.
    • Centralized Algolia search client initialization added for search usage.

Review Change Stack

- Replace ng5-slider package with @angular-slider/ngx-slider
- Update imports in component and module files
- Update HTML template tags from ng5-slider to ngx-slider
- Update CSS selectors in global.scss
- Update package.json dependency
- Run build to verify compatibility
@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@gacorpoll-ui has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 20 minutes and 13 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 82b81bde-3079-469b-8dd8-b07f089cfad3

📥 Commits

Reviewing files that changed from the base of the PR and between 007f3c1 and 74ddf80.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • package.json
  • src/app/pages/logged-in/transfer/transfer-form/transfer-form.page.ts
📝 Walkthrough

Walkthrough

Replaces ng5-slider with @angular-slider/ngx-slider in templates, modules, types, and styles; removes angular-instantsearch usage and bumps algoliasearch while adding a new AlgoliaService; and updates the tt-metal submodule pointer.

Changes

Slider Library Replacement

Layer / File(s) Summary
Dependency and module wiring
package.json, src/app/components/age-refinement-list/age-refinement-list.module.ts, src/app/components/range-refinement-list/range-refinement-list.module.ts
Added @angular-slider/ngx-slider and replaced Ng5SliderModule imports with NgxSliderModule.
Component template migration
src/app/components/age-refinement-list/age-refinement-list.component.html, src/app/components/range-refinement-list/range-refinement-list.html
Replaced ng5-slider tags with ngx-slider, preserving value bindings, event handlers, and [options].
Type imports and component adjustments
src/app/components/age-refinement-list/age-refinement-list.component.ts, src/app/components/date-range-refinement-list/date-range-refinement-list.component.ts, src/app/components/range-refinement-list/range-refinement-list.ts
Updated Options imports to @angular-slider/ngx-slider and removed an override modifier from a state property.
Global styling
src/global.scss
Renamed selectors and nested elements from ng5-slider to ngx-slider and adjusted trailing brace spacing.

Algolia removal and service

Layer / File(s) Summary
Package and module updates
package.json, src/app/pages/logged-in/candidate/candidate-search/candidate-search.module.ts, src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.module.ts
Bumped algoliasearch, removed angular-instantsearch from dependencies, and commented out/removed NgAisModule imports from feature modules.
Page templates and imports
src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.html, src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts, src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts
Candidate page now renders a manual-search block guarded by *ngIf="instantSearchConfig"; direct algoliasearch imports were commented out and related encode import was adjusted. Fulltimer page also has the algoliasearch import commented out.
Algolia service
src/app/providers/algolia.service.ts
Adds a root-provided AlgoliaService that creates a lite Algolia client from environment config and exposes createIndex(indexName).

Submodule

Layer / File(s) Summary
tt-metal pointer
tt-metal
Updated the recorded commit hash for the tt-metal submodule.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #33: Matches the ng5-slider → @angular-slider/ngx-slider migration across package.json, imports, templates, and types.

Poem

🐰 I hopped through sliders, sharp and spry,
Swapped ng5 for ngx with a twinkling eye,
Algolia ports trimmed, a service born anew,
Submodule advanced — commits in view,
A rabbit cheers: the code can slide! 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the primary change in the changeset: replacing ng5-slider with @angular-slider/ngx-slider across multiple files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/app/components/range-refinement-list/range-refinement-list.html (1)

46-48: ⚠️ Potential issue | 🟠 Major

Verify event names and bindings compatibility with @angular-slider/ngx-slider.

Same concern as in age-refinement-list.component.html: the event bindings (userChangeEnd) and (userChange) need verification for compatibility with the new library's API.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/components/range-refinement-list/range-refinement-list.html` around
lines 46 - 48, The ngx-slider element in the RangeRefinementList template is
using (userChangeEnd) and (userChange) bound to handleChange() and setLabel();
confirm these event names against `@angular-slider/ngx-slider` docs and update the
template to use the library's actual output events (for example
valueChange/highValueChange or userChange/userChangeEnd depending on the
installed version) and ensure the handlers on the RangeRefinementList component
(handleChange, setLabel) accept any event payloads the new events emit and
update internal state accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Line 21: Update the package.json dependency for the Angular slider: replace
the current version specifier for "@angular-slider/ngx-slider" (currently
"^14.0.0") with the Angular-15 compatible release "^15.0.0" so the project uses
the library built for Angular 15 / RxJS 7 compatibility; then run your
dependency install (npm/yarn) and verify no breaking peer dependency warnings.

---

Duplicate comments:
In `@src/app/components/range-refinement-list/range-refinement-list.html`:
- Around line 46-48: The ngx-slider element in the RangeRefinementList template
is using (userChangeEnd) and (userChange) bound to handleChange() and
setLabel(); confirm these event names against `@angular-slider/ngx-slider` docs
and update the template to use the library's actual output events (for example
valueChange/highValueChange or userChange/userChangeEnd depending on the
installed version) and ensure the handlers on the RangeRefinementList component
(handleChange, setLabel) accept any event payloads the new events emit and
update internal state accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b371f073-a680-4e28-820f-4b4caaa14732

📥 Commits

Reviewing files that changed from the base of the PR and between 39a33ff and 509955c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • package.json
  • src/app/components/age-refinement-list/age-refinement-list.component.html
  • src/app/components/age-refinement-list/age-refinement-list.component.ts
  • src/app/components/age-refinement-list/age-refinement-list.module.ts
  • src/app/components/date-range-refinement-list/date-range-refinement-list.component.ts
  • src/app/components/range-refinement-list/range-refinement-list.html
  • src/app/components/range-refinement-list/range-refinement-list.module.ts
  • src/app/components/range-refinement-list/range-refinement-list.ts
  • src/global.scss

Comment thread package.json
},
"private": true,
"dependencies": {
"@angular-slider/ngx-slider": "^14.0.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🌐 Web query:

@angular-slider/ngx-slider compatibility with Angular 15

💡 Result:

The @angular-slider/ngx-slider package provides explicit support for Angular 15 [1][2][3]. Specifically, version 15.x of the library is designed to be compatible with Angular 15 and requires RxJS 7.x [1][2][3]. You can verify this compatibility in the official package documentation and the project's changelog, which confirms that the 15.0.0 release was a backport targeting Angular 15 [1][4]. Note that as of May 2026, the maintainers only actively support the latest three versions of the library [1][2].

Citations:


Update @angular-slider/ngx-slider to version 15.x for Angular 15 compatibility.

The current version ^14.0.0 is not compatible with Angular 15. The library provides version 15.x specifically designed for Angular 15 with RxJS 7.x support. Update the dependency to ^15.0.0.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` at line 21, Update the package.json dependency for the Angular
slider: replace the current version specifier for "@angular-slider/ngx-slider"
(currently "^14.0.0") with the Angular-15 compatible release "^15.0.0" so the
project uses the library built for Angular 15 / RxJS 7 compatibility; then run
your dependency install (npm/yarn) and verify no breaking peer dependency
warnings.

- Remove ng5-slider dependency
- Install @angular-slider/ngx-slider
- Update imports in modules and components
- Update template references from ng5-slider to ngx-slider
- Created new Algolia service for instantsearch.js migration
- Updated search pages to use instantsearch.js instead of angular-instantsearch

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.html (1)

62-118: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Restore NgAisModule import to fix template compilation.

<ais-infinite-hits> at lines 90 and 105 requires NgAisModule from angular-instantsearch, but the import is commented out at line 16 of candidate-search.module.ts. Although BawesAisPaginationModuleModule imports NgAisModule internally, it only exports its own component and does not re-export NgAisModule, leaving the ais-infinite-hits component unavailable. This causes a template compilation error.

Uncomment the NgAisModule import in the module to resolve.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.html`
around lines 62 - 118, The template error is caused by <ais-infinite-hits> not
being available because NgAisModule import was commented out; open
candidate-search.module.ts and restore (uncomment) the NgAisModule import and
add it to the module's imports array so the angular-instantsearch components
(e.g., ais-infinite-hits) are declared for this feature module; note that
BawesAisPaginationModuleModule does not re-export NgAisModule, so you must
import NgAisModule directly into this module.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@package.json`:
- Around line 52-59: Three call sites still use the old Algolia v4-style
client.initIndex(indexName) which is removed in v5; update the three locations
(src/app/providers/logged-in/algolia.service.ts around the uses at lines ~81 and
~96, and src/app/providers/algolia.service.ts near line ~11) to use the v5 API:
replace client.initIndex(...) usages with the appropriate v5 calls (for
retrieving objects use client.getObject / client.getObjects or use
client.index(indexName) and then the index methods for search/save/update as
required) and update any downstream method calls (search, saveObjects,
getObject, etc.) to the v5 signatures—follow the Algolia v5 migration guide to
map each initIndex+operation to the correct v5 client/index method.

In `@src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts`:
- Around line 7-9: Uncomment and restore the Algolia client import so the
algoliasearch() call resolves: add a proper default import like import
algoliasearch from 'algoliasearch' (or the appropriate package entry your
project uses) at the top of the file where the commented line currently is,
replacing the commented // import algoliasearch... line so calls to
algoliasearch() in this module (e.g., the function that initializes the client)
compile correctly.

In `@src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts`:
- Line 6: Uncomment and restore the Algolia import so the algoliasearch(...)
call used in FulltimerSearchPage (seen at the invocation in
fulltimer-search.page.ts around the algoliasearch(...) call) compiles: replace
the commented import with the lite client import (import algoliasearch from
'algoliasearch/lite') so the algoliasearch symbol is available for the existing
initialization code in this file.

In `@src/app/providers/algolia.service.ts`:
- Around line 10-11: The createIndex method currently calls removed
client.initIndex(indexName); update it to use the Algolia v5 client API by
replacing the initIndex call with the direct client index operation (e.g., use
this.client.index(indexName) or the appropriate client method that accepts
indexName as a parameter) so createIndex(indexName: string) returns the new
index object; adjust any code that expects the old initIndex return shape if
needed.

---

Outside diff comments:
In
`@src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.html`:
- Around line 62-118: The template error is caused by <ais-infinite-hits> not
being available because NgAisModule import was commented out; open
candidate-search.module.ts and restore (uncomment) the NgAisModule import and
add it to the module's imports array so the angular-instantsearch components
(e.g., ais-infinite-hits) are declared for this feature module; note that
BawesAisPaginationModuleModule does not re-export NgAisModule, so you must
import NgAisModule directly into this module.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0edca95-c176-473f-828c-8fff1870c8a6

📥 Commits

Reviewing files that changed from the base of the PR and between 509955c and 007f3c1.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • package.json
  • src/app/components/age-refinement-list/age-refinement-list.component.ts
  • src/app/components/age-refinement-list/age-refinement-list.module.ts
  • src/app/components/range-refinement-list/range-refinement-list.ts
  • src/app/pages/logged-in/candidate/candidate-search/candidate-search.module.ts
  • src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.html
  • src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts
  • src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.module.ts
  • src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts
  • src/app/providers/algolia.service.ts
  • tt-metal
✅ Files skipped from review due to trivial changes (1)
  • tt-metal
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/app/components/age-refinement-list/age-refinement-list.module.ts
  • src/app/components/age-refinement-list/age-refinement-list.component.ts
  • src/app/components/range-refinement-list/range-refinement-list.ts

Comment thread package.json
Comment on lines +52 to +59
"algoliasearch": "^5.52.1",
"aws-sdk": "^2.1279.0",
"chart.js": "^4.1.1",
"cordova-plugin-file": "^7.0.0",
"cordova-plugin-nativestorage": "^2.3.2",
"date-fns": "^2.29.3",
"file-saver": "^2.0.5",
"instantsearch.js": "^4.97.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Check for v4-only Algolia API usage (expected: no matches):"
rg -nP --type=ts -C2 "\\binitIndex\\s*\\("

echo
echo "Locate Algolia imports and nearby usage:"
rg -nP --type=ts -C2 "from\\s+['\\\"]algoliasearch(?:/lite)?['\\\"]"

echo
echo "Inspect Algolia service wrappers for migrated method patterns:"
fd -i "algolia*.ts" src | xargs -r rg -n -C2 "algoliasearch|initIndex|search\\(|saveObject|saveObjects|deleteIndex|operationIndex"

Repository: BAWES-Universe/studenthub-staff

Length of output: 2941


Migrate Algolia v4 API calls to v5 before applying package upgrade.

The algoliasearch upgrade to v5.52.1 removed the initIndex() method. Three locations still use the deprecated v4-style API and will fail at runtime:

  • src/app/providers/logged-in/algolia.service.ts lines 81 and 96
  • src/app/providers/algolia.service.ts line 11

Replace client.initIndex(indexName) with client.getObject() or appropriate v5 client methods. Refer to Algolia v5 migration guide for the correct method signatures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@package.json` around lines 52 - 59, Three call sites still use the old
Algolia v4-style client.initIndex(indexName) which is removed in v5; update the
three locations (src/app/providers/logged-in/algolia.service.ts around the uses
at lines ~81 and ~96, and src/app/providers/algolia.service.ts near line ~11) to
use the v5 API: replace client.initIndex(...) usages with the appropriate v5
calls (for retrieving objects use client.getObject / client.getObjects or use
client.index(indexName) and then the index methods for search/save/update as
required) and update any downstream method calls (search, saveObjects,
getObject, etc.) to the v5 signatures—follow the Algolia v5 migration guide to
map each initIndex+operation to the correct v5 client/index method.

Comment on lines +7 to +9
// import algoliasearch from 'algoliasearch/index';
import * as VERSION from 'algoliasearch-helper/src/version';
import * as encodeProxy from 'querystring-es3/encode';
import * as encodeProxy from 'querystring-es3';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify unresolved symbol risk in this file
rg -n "algoliasearch\\(" src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts
rg -n "import\\s+algoliasearch" src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts

Repository: BAWES-Universe/studenthub-staff

Length of output: 183


🏁 Script executed:

cat -n src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts | head -50

Repository: BAWES-Universe/studenthub-staff

Length of output: 2326


🏁 Script executed:

cat -n src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts | sed -n '320,340p'

Repository: BAWES-Universe/studenthub-staff

Length of output: 947


🏁 Script executed:

rg -n "algoliasearch" src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts

Repository: BAWES-Universe/studenthub-staff

Length of output: 246


algoliasearch is used but its import is commented out, causing a compilation failure.

Line 7 comments out the import, but algoliasearch() is called at line 330, resulting in Cannot find name 'algoliasearch' error.

Uncomment and update the import path:

Fix
-// import algoliasearch from 'algoliasearch/index';
+import algoliasearch from 'algoliasearch/lite';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// import algoliasearch from 'algoliasearch/index';
import * as VERSION from 'algoliasearch-helper/src/version';
import * as encodeProxy from 'querystring-es3/encode';
import * as encodeProxy from 'querystring-es3';
import algoliasearch from 'algoliasearch/lite';
import * as VERSION from 'algoliasearch-helper/src/version';
import * as encodeProxy from 'querystring-es3';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/pages/logged-in/candidate/candidate-search/candidate-search.page.ts`
around lines 7 - 9, Uncomment and restore the Algolia client import so the
algoliasearch() call resolves: add a proper default import like import
algoliasearch from 'algoliasearch' (or the appropriate package entry your
project uses) at the top of the file where the commented line currently is,
replacing the commented // import algoliasearch... line so calls to
algoliasearch() in this module (e.g., the function that initializes the client)
compile correctly.

import { HttpClient, HttpHeaders } from '@angular/common/http';
import { TransferState, makeStateKey } from '@angular/platform-browser';
import algoliasearch from 'algoliasearch';
// import algoliasearch from 'algoliasearch';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify unresolved symbol risk in this file
rg -n "algoliasearch\\(" src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts
rg -n "import\\s+algoliasearch" src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts

Repository: BAWES-Universe/studenthub-staff

Length of output: 177


Uncomment algoliasearch import to fix compile error.

The algoliasearch(...) function is invoked at line 258, but the import is commented out at line 6. Uncomment the import and use the /lite variant:

Fix
-// import algoliasearch from 'algoliasearch';
+import algoliasearch from 'algoliasearch/lite';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// import algoliasearch from 'algoliasearch';
import algoliasearch from 'algoliasearch/lite';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/pages/logged-in/fulltimer/fulltimer-search/fulltimer-search.page.ts`
at line 6, Uncomment and restore the Algolia import so the algoliasearch(...)
call used in FulltimerSearchPage (seen at the invocation in
fulltimer-search.page.ts around the algoliasearch(...) call) compiles: replace
the commented import with the lite client import (import algoliasearch from
'algoliasearch/lite') so the algoliasearch symbol is available for the existing
initialization code in this file.

Comment on lines +10 to +11
createIndex(indexName: string) {
return this.client.initIndex(indexName);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Algolia JavaScript API client v5 migration: is client.initIndex() removed, and what is the recommended replacement pattern?

💡 Result:

Yes, the client.initIndex() method has been removed in the Algolia JavaScript API client v5 [1]. In version 5, the client architecture has been updated to be more consistent and aligned with generated OpenAPI specifications [1]. Instead of creating an intermediate index object via initIndex(), all API methods are now called directly on the client instance [2][1]. The recommended replacement pattern is to call the desired method directly on the client and pass the indexName as a parameter [2][1]. For example, if you previously used: // version 4 const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); const index = client.initIndex("ALGOLIA_INDEX_NAME"); const results = index.search("QUERY"); You should now use: // version 5 const client = algoliasearch("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"); const results = await client.searchSingleIndex({ indexName: "ALGOLIA_INDEX_NAME", searchParams: { query: "QUERY" }, }); To migrate your codebase, it is recommended to search for all occurrences of initIndex or .initIndex( and replace them with the corresponding direct client method calls that include the indexName parameter [1].

Citations:


🏁 Script executed:

# Check package.json for algoliasearch version
cat package.json | grep -A 2 -B 2 "algoliasearch"

Repository: BAWES-Universe/studenthub-staff

Length of output: 233


🏁 Script executed:

# Read the full algolia.service.ts file
cat -n src/app/providers/algolia.service.ts

Repository: BAWES-Universe/studenthub-staff

Length of output: 610


🏁 Script executed:

# Search for usages of createIndex method
rg "createIndex" --type ts --type js -B 2 -A 2

Repository: BAWES-Universe/studenthub-staff

Length of output: 436


🏁 Script executed:

# Search for actual usages/calls to createIndex method
rg "\.createIndex\(" --type ts --type js -B 2 -A 2

Repository: BAWES-Universe/studenthub-staff

Length of output: 57


🏁 Script executed:

# Also search for AlgoliaService usage patterns
rg "AlgoliaService" --type ts --type js -B 2 -A 2

Repository: BAWES-Universe/studenthub-staff

Length of output: 4212


client.initIndex() removed in algoliasearch v5—method will fail at runtime.

The package uses algoliasearch v5.52.1, which removed initIndex() in favor of direct client method calls. This method must be migrated to call client methods directly with indexName as a parameter (e.g., client.searchSingleIndex({ indexName, ... })).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/providers/algolia.service.ts` around lines 10 - 11, The createIndex
method currently calls removed client.initIndex(indexName); update it to use the
Algolia v5 client API by replacing the initIndex call with the direct client
index operation (e.g., use this.client.index(indexName) or the appropriate
client method that accepts indexName as a parameter) so createIndex(indexName:
string) returns the new index object; adjust any code that expects the old
initIndex return shape if needed.

- Remove moment.js dependency
- Install date-fns@3
- Remove moment import from transfer-form page
- Update type annotation to remove 'moment' option
- Verify no remaining moment.js usage in codebase
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