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

Doesnt Work with Angular 10.0.4 #738

Closed juanjinario closed 3 years ago

juanjinario commented 4 years ago

I was unable to update my Angular project to version 10 because angular-instantsearch does not allow it. The versions that I have installed are:

  "algoliasearch": "^3.35.1",
    "angular-instantsearch": "^3.0.0-beta.5",
    "instantsearch.js": "^4.6.0",
eunjae-lee commented 4 years ago

Hi @juanjinario , I'm sorry that you're having a trouble with Angular InstantSearch and Angular 10. To be honest, we haven't properly investigated on the support for Angular 10. I hope we can come up with it soon, but I'm afraid we cannot estimate the time yet.

Could you log what you faced there? It will be helpful when we get into it.

juanjinario commented 4 years ago

I receive this error messages: @eunjae-lee

Package "angular-instantsearch" has an incompatible peer dependency to "@angular/core" (requires ">=5.0.0 <9.0.0" (extended), would install "10.0.5").
                  Package "angular-instantsearch" has an incompatible peer dependency to "@angular/common" 
(requires ">=5.0.0 <9.0.0" (extended), would install "10.0.5").
                  Package "angular-instantsearch" has an incompatible peer dependency to "@angular/platform-browser" (requires ">=5.0.0 <9.0.0" (extended), would install "10.0.5").
                  Package "angular-instantsearch" has an incompatible peer dependency to "@angular/platform-browser-dynamic" (requires ">=5.0.0 <9.0.0" (extended), would install "10.0.5").
× Migration failed: Incompatible peer dependencies found.
Peer dependency warnings when installing dependencies means that those dependencies might not work correctly together.
-browser-dynamic" (requires ">=5.0.0 <9.0.0" (extended), would install "10.0.5").

I can force update with the --force flag, but I don't know if something will be damaged, I need to know if everything will work fine

Haroenv commented 4 years ago

This is just a warning, which is in place, since we officially only support up until angular 8. If you actually install it with --force, do you receive any errors?

juanjinario commented 4 years ago

We only use the Angular-instasearch widget, which could work at the moment, I need the guarantee that all the features of Algolia will work in this version (current 10) and that I will not have to return from Angular version. I cannot do a test on my production project.

ghost commented 4 years ago
ERROR in node_modules/angular-instantsearch/instantsearch/instantsearch.module.d.ts:3:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

    3     static forRoot(): ModuleWithProviders;
                            ~~~~~~~~~~~~~~~~~~~
    node_modules/angular-instantsearch/index.d.ts:63:23 - error TS2314: Generic type 'ModuleWithProviders<T>' requires 1 type argument(s).

How to ignore it, or what I should do ?) Angular v10.0.2 angular-instantsearch v3.0.0-beta.5

Haroenv commented 4 years ago

@abzalzhumabaev, this one seems difficult to keep supporting older versions (pre Angular 7)

see: https://angular.io/guide/deprecations#modulewithproviders-type-without-a-generic

A solution for now should be to use https://angular.io/guide/glossary#ngcc, or if that doesn't work, something like patch-package to change:

import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';

import { NgAisInstantSearch } from './instantsearch';

@NgModule({
  declarations: [NgAisInstantSearch],
  entryComponents: [NgAisInstantSearch],
  exports: [NgAisInstantSearch],
  imports: [CommonModule],
})
export class NgAisInstantSearchModule {
  public static forRoot(): ModuleWithProviders {
    return {
      ngModule: NgAisInstantSearchModule,
      providers: [],
    };
  }
}

to:

import { CommonModule } from '@angular/common';
import { ModuleWithProviders, NgModule } from '@angular/core';

import { NgAisInstantSearch } from './instantsearch';

@NgModule({
  declarations: [NgAisInstantSearch],
  entryComponents: [NgAisInstantSearch],
  exports: [NgAisInstantSearch],
  imports: [CommonModule],
})
export class NgAisInstantSearchModule {
  public static forRoot(): ModuleWithProviders<NgAisInstantSearchModule> {
    return {
      ngModule: NgAisInstantSearchModule,
      providers: [],
    };
  }
}
ictus4u commented 4 years ago

I've got these warnings after npm install, with ngcc as postinstall task:

npm WARN angular-instantsearch@2.3.0 requires a peer of @angular/common@>=5.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-instantsearch@2.3.0 requires a peer of @angular/core@>=5.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-instantsearch@2.3.0 requires a peer of @angular/platform-browser@>=5.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angular-instantsearch@2.3.0 requires a peer of @angular/platform-browser-dynamic@>=5.0.0 <9.0.0 but none is installed. You must install peer dependencies yourself.

Environment:

Angular CLI: 10.1.2
Node: 12.18.4
OS: linux x64

Angular: 10.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router, service-worker
Ivy Workspace: Yes
Haroenv commented 4 years ago

@ictus4u, those seem like warnings, and not errors. Does it actually not work or just print the warning?

Note also that you probably want to use angular-instantsearch@beta

aldric commented 4 years ago

Hello guys. Still no plan to upgrade to Angular 10+ ? It would be really appreciated . Thanks

michelepatrassi commented 3 years ago

using v3.0.0-beta.5 with angular 10.1.5 for a side project with a search functionality, no problem so far. I'm actually going to give a try to angular 11

keduardo2117 commented 3 years ago

using v3.0.0-beta.5 with angular 10.1.5 for a side project with a search functionality, no problem so far. I'm actually going to give a try to angular 11

Did v3.0.0-beta-5 worked with Angular 11? I'm looking to update to 11 too.

eunjae-lee commented 3 years ago

https://github.com/eunjae-lee/my-angular11-app

I made this simple example with angular 11 + angular InstantSearch@beta. Can you see if it works for you?

keduardo2117 commented 3 years ago

I force updated to angular 11.1.2 and the instant search is working for me.

Is this project still maintained? It's been almost a year since the last release.

ramikhafagi96 commented 3 years ago

Is there any plan to start supporting Angular10+? it is really needed. Thanks

francoischalifour commented 3 years ago

Hey all! The latest contributions happen on the v4 branch, which is why the master branch might feel left behind.

We're in the process of planning our priorities for the coming months and we'll provide official support for Angular 10+.

ramikhafagi96 commented 3 years ago

Hey all! The latest contributions happen on the v4 branch, which is why the master branch might feel left behind.

We're in the process of planning our priorities for the coming months and we'll provide official support for Angular 10+.

Should we install the package using the v4 branch to avoid issues in Angular 10+ ?

francoischalifour commented 3 years ago

We've released 4.0.0-alpha.0 which brings basic support for Angular 10+. We'll release on this alpha tag for further improvements.

You can install it now:

npm install angular-instantsearch@4.0.0-alpha.0
# or
yarn add angular-instantsearch@4.0.0-alpha.0

Please feel free to open issues for any bug you may encounter.

s5no5t commented 3 years ago

@francoischalifour just so I understand the plan here - is v3 the next version to be released as stable, or is it v4? Both are in beta/alpha currently it seems, and the v4 branch is behind the v3 one.

francoischalifour commented 3 years ago

Long term, v4 (which is currently alpha) will provide support for Angular 10+, so it'll be the version we'll release stable in the future.

somehan commented 3 years ago

similar issue: https://github.com/algolia/angular-instantsearch/issues/813

cam424 commented 3 years ago

angular-instantsearch@4.0.0-alpha.0 still requires a peer dependency of @angular/common of < 9.0.0 so like ¯_(ツ)_/¯

tkrugg commented 3 years ago

@cam424 please use alpha.1

ramikhafagi96 commented 3 years ago

@tkrugg how to install it with npm please?

Haroenv commented 3 years ago

npm install angular-instantsearch@4.0.0-alpha.1 @ramikhafagi96 :), make sure to remove the InstantSearch.js version in your package.json too if you're not explicitly using it

twawrzyczny commented 3 years ago

I've tried importing both 4.0.0-alpha.1 and 4.0.0-alpha.2 and both are giving me this error on build:

ERROR in ./node_modules/angular-instantsearch/fesm2015/angular-instantsearch.js Module not found: Error: Can't resolve 'algoliasearch/lite' in 'C:\projects\stash\web\node_modules\angular-instantsearch\fesm2015' @ ./node_modules/angular-instantsearch/fesm2015/angular-instantsearch.js 4:0-57 99:24-50 99:54-72 2547:30-56 2548:6-32 2549:6-24 @ ./js/app/components2/search-box/search-box.component.ts @ ./js/app/components2/components.module.ts @ ./js/app/modules/app.module.ts @ ./js/app/modules/preApp.module.js @ ./js/app/app-scripts.ts

ERROR in C:/projects/stash/cinemaweb7-v2/Cinema.Web/node_modules/angular-instantsearch/create-ssr-search-client.d.ts ERROR in C:/projects/stash/cinemaweb7-v2/Cinema.Web/node_modules/angular-instantsearch/create-ssr-search-client.d.ts(13,174): TS2694: Namespace 'algoliasearch' has no exported member 'SearchClient'.

Haroenv commented 3 years ago

@twawrzyczny what's in your package.json? Do you have algoliasearch@4 installed?

tkrugg commented 3 years ago

@twawrzyczny closing. if you're still experiencing issues feel free to reopen.