algolia / angular-instantsearch

⚡️Lightning-fast search for Angular apps, by Algolia
https://algolia.com/doc/deprecated/instantsearch/angular/v4/api-reference/instantsearch/
MIT License
261 stars 73 forks source link

Angular Instantsearch version contraints very out of date, fails NPM 7 version solving for Angular >8 #806

Closed jadengis closed 3 years ago

jadengis commented 3 years ago

Is your feature request related to a problem? Please describe 🙏

Currently, the Angular version constraints for this library are >=5.0.0 && <9.0.0. As a result, the new version solving algorithm introduced in NPM 7 cannot complete successfully for people who are using Angular >8. Considering that Angular 9 is well over a year old, this version constraint is very out of date.

Describe the solution you'd like 🤔

Expand the version contraint on this library to support and include up-to-date versions of Angular (11 at the time of writing).

Describe alternatives you've considered ✨

NPM 7 will work with --legacy-peer-deps but it isn't recommended if one can use the new algorithm as it is safer and more reliable.

eunjae-lee commented 3 years ago

Hello @jadengis Thanks for reaching out to us and creating the issue. We haven't assigned enough time on Angular InstantSearch lately. We are planning to update Angular InstantSearch to include the latest version of the core part from InstantSearch.js. We'll make sure to update this part as well. I'll keep the issue open until it's done.

DarylSmith commented 3 years ago

Thanks @eunjae-lee I appreciate this. Just wondering if there is any timeline for this update -- our team is currently building our new site on Angular 10, and we're putting together our project plan. Would you say it will be with the next month, or 3 month period?

Mutondi commented 3 years ago

How can we start contributing to this repo, this package is useful to the internet community.

Haroenv commented 3 years ago

The latest branch is https://github.com/algolia/angular-instantsearch/tree/v4,for which what's needed for a release is checking if all code indeed works in modern code paths, and making it compatible with the search client v4. Other contributions can also be to update typescript compatibility in the underlying InstantSearch.js library

If however you try the library out on your side and you see it working completely fine in v4 for angular v10+, we can cut an alpha release early.

On the other hand the documentation also still needs to be updated, but that's closed source unfortunately

mwawrusch commented 3 years ago

Just upgraded to angular 11 and get this error: vendor.js:13959 Uncaught ReferenceError: process is not defined

because of this line of code in your library:

var RESET_APP_DATA_TIMER = process.env.RESET_APP_DATA_TIMER && parseInt(process.env.RESET_APP_DATA_TIMER, 10) || 60 2 1000; // after 2 minutes reset to first host

jadengis commented 3 years ago

@mwawrusch angular-instantsearch works for me with angular 11, but I had to include the following polyfills (in a file aptly named algolia-hacks.ts).

/***************************************************************************************************
 * Quick polyfill for process so that algolia instantsearch works with Angular6+
 * @see https://github.com/algolia/algoliasearch-client-javascript/issues/691
 *
 * This also includes a dirty hack required to get autocomplete.js to work.
 * @See https://stackoverflow.com/questions/56116521/how-to-fix-process-nexttick-is-not-a-function-with-calgolia-places-js
 */
(window as any).process = {
  env: { DEBUG: undefined },
  nextTick: () => {
    return null;
  },
};

/***************************************************************************************************
 * Another quick polyfill to define Node.js's `global` for the browser environment so that
 * autocomplete.js can actually load properly.
 */
(window as any).global = window;

/***************************************************************************************************
 * Another hack to hopefully resolve the issue that Algolia has in Angular 9.
 */
// eslint-disable-next-line @typescript-eslint/camelcase
(window as any).algoliasearchProxy__default = null;
// eslint-disable-next-line @typescript-eslint/camelcase
(window as any).encodeProxy__default = null;
Haroenv commented 3 years ago

https://www.npmjs.com/package/angular-instantsearch/v/4.0.0-alpha.0 the first alpha of v4 has been released