From a8976f12316573f9149fd459d5d87c232188c02f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Thu, 19 Jul 2018 14:21:40 +0200 Subject: [PATCH 1/2] refactor(templates): Declare the search client outside of the component --- scripts/__snapshots__/e2e-templates.test.js.snap | 4 +++- src/templates/Angular InstantSearch/src/app/app.component.ts | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/__snapshots__/e2e-templates.test.js.snap b/scripts/__snapshots__/e2e-templates.test.js.snap index 05adc689d..ae9923905 100644 --- a/scripts/__snapshots__/e2e-templates.test.js.snap +++ b/scripts/__snapshots__/e2e-templates.test.js.snap @@ -386,6 +386,8 @@ exports[`Templates Angular InstantSearch File content: src/app/app.component.ts "import { Component } from '@angular/core'; import * as algoliasearch from 'algoliasearch'; +const searchClient = algoliasearch('appId', 'apiKey'); + @Component({ selector: 'app-root', templateUrl: './app.component.html', @@ -394,7 +396,7 @@ import * as algoliasearch from 'algoliasearch'; export class AppComponent { config = { indexName: 'indexName', - searchClient: algoliasearch('appId', 'apiKey'), + searchClient, }; }" `; diff --git a/src/templates/Angular InstantSearch/src/app/app.component.ts b/src/templates/Angular InstantSearch/src/app/app.component.ts index 97013279d..eadb38f37 100644 --- a/src/templates/Angular InstantSearch/src/app/app.component.ts +++ b/src/templates/Angular InstantSearch/src/app/app.component.ts @@ -1,6 +1,8 @@ import { Component } from '@angular/core'; import * as algoliasearch from 'algoliasearch'; +const searchClient = algoliasearch('{{appId}}', '{{apiKey}}'); + @Component({ selector: 'app-root', templateUrl: './app.component.html', @@ -9,6 +11,6 @@ import * as algoliasearch from 'algoliasearch'; export class AppComponent { config = { indexName: '{{indexName}}', - searchClient: algoliasearch('{{appId}}', '{{apiKey}}'), + searchClient, }; } From d1541f7fd3b3fb49ff00f95c91e7f69b2ea6ea9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Chalifour?= Date: Thu, 19 Jul 2018 14:26:12 +0200 Subject: [PATCH 2/2] style(templates): Reformat search clients --- scripts/__snapshots__/e2e-templates.test.js.snap | 9 ++++++--- .../Angular InstantSearch/src/app/app.component.ts | 5 ++++- src/templates/React InstantSearch/src/App.js.hbs | 4 ++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/__snapshots__/e2e-templates.test.js.snap b/scripts/__snapshots__/e2e-templates.test.js.snap index ae9923905..8d4d36312 100644 --- a/scripts/__snapshots__/e2e-templates.test.js.snap +++ b/scripts/__snapshots__/e2e-templates.test.js.snap @@ -386,7 +386,10 @@ exports[`Templates Angular InstantSearch File content: src/app/app.component.ts "import { Component } from '@angular/core'; import * as algoliasearch from 'algoliasearch'; -const searchClient = algoliasearch('appId', 'apiKey'); +const searchClient = algoliasearch( + 'appId', + 'apiKey' +); @Component({ selector: 'app-root', @@ -3782,8 +3785,8 @@ import PropTypes from 'prop-types'; import './App.css'; const searchClient = algoliasearch( - 'appId', - 'apiKey' + 'appId', + 'apiKey' ); class App extends Component { diff --git a/src/templates/Angular InstantSearch/src/app/app.component.ts b/src/templates/Angular InstantSearch/src/app/app.component.ts index eadb38f37..8c4a52972 100644 --- a/src/templates/Angular InstantSearch/src/app/app.component.ts +++ b/src/templates/Angular InstantSearch/src/app/app.component.ts @@ -1,7 +1,10 @@ import { Component } from '@angular/core'; import * as algoliasearch from 'algoliasearch'; -const searchClient = algoliasearch('{{appId}}', '{{apiKey}}'); +const searchClient = algoliasearch( + '{{appId}}', + '{{apiKey}}' +); @Component({ selector: 'app-root', diff --git a/src/templates/React InstantSearch/src/App.js.hbs b/src/templates/React InstantSearch/src/App.js.hbs index ed936812d..53428e78d 100644 --- a/src/templates/React InstantSearch/src/App.js.hbs +++ b/src/templates/React InstantSearch/src/App.js.hbs @@ -16,8 +16,8 @@ import PropTypes from 'prop-types'; import './App.css'; const searchClient = algoliasearch( - '{{appId}}', - '{{apiKey}}' + '{{appId}}', + '{{apiKey}}' ); class App extends Component {