Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

feat(algoliasearch): add support for algoliasearch v4 #756

Merged
merged 2 commits into from
Jan 22, 2020

Conversation

yannickcr
Copy link
Contributor

@yannickcr yannickcr commented Jan 13, 2020

This change add support for algoliasearch v4 to Vue-InstantSearch.

No changes were necessary in the code. Also since the client is mocked in the unit tests we did not add an extra job on CIrcleCI to test with the 2 versions of the client.

The examples were updated to use the latest v4 beta.

Important note: we also upgraded the algoliasearch-helper dependency to 3.0.0 which is the version that support algoliasearch v4.

Update: after upgrading algoliasearch-helper from 2.26.1 ot 3.0.0 the bundle size jumped from 59KB to 68KB. We need to investigate on it:

Bundle size Before:
┌────────────────────────────────────────────┐
│                                            │
│   Destination: dist/vue-instantsearch.js   │
│   Bundle Size:  241.07 KB                  │
│   Minified Size:  238.69 KB                │
│   Gzipped Size:  59.32 KB                  │
│                                            │
└────────────────────────────────────────────┘

After:

┌────────────────────────────────────────────┐
│                                            │
│   Destination: dist/vue-instantsearch.js   │
│   Bundle Size:  281.83 KB                  │
│   Minified Size:  279.41 KB                │
│   Gzipped Size:  67.93 KB                  │
│                                            │
└────────────────────────────────────────────

@yannickcr yannickcr requested a review from a team January 13, 2020 16:48
@francoischalifour
Copy link
Member

The bundle size increased because:

  • Vue InstantSearch v2 uses InstantSearch.js v3
  • InstantSearch.js v3 uses JavaScript Helper v2
  • This PR introduced JavaScript Helper v3
  • → There's now a duplication of the JavaScript Helper 2 and 3 in this repo

We cannot use the JavaScript Helper v3 in Vue InstantSearch v2 because it introduced breaking changes. Why isn't the Client v4 compatible with the Helper v2? (if that's only because of the package.json range, we can release a version that updates it)

@ghost ghost requested review from eunjae-lee and Haroenv and removed request for a team January 13, 2020 17:30
@Haroenv
Copy link
Contributor

Haroenv commented Jan 15, 2020

Yes, either we make the client v4 workable with v2 of the helper, or we do this change only in the next branch on Vue InstantSearch

package.json Outdated
@@ -47,11 +47,11 @@
"release:publish": "scripts/release-publish.sh"
},
"dependencies": {
"algoliasearch-helper": "^2.26.1",
"algoliasearch-helper": "^3.0.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"algoliasearch-helper": "^3.0.0",
"algoliasearch-helper": "^2.28.1",

InstantSearch.js v3 needs an update with this too (however it should also be deduplicated if it doesn't)

Choose a reason for hiding this comment

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

Confirmed, we still get Gzipped Size: 68.82 KB with this update. We need to update instantsearch first right?


/Users/nunomaduro/Algolia/vue-instantsearch/node_modules/algoliasearch-helper/package.json:
    1  {
    2:   "name": "algoliasearch-helper",
    3    "version": "2.28.1",
    4    "description": "Helper for implementing advanced search features with algolia",

/Users/nunomaduro/Algolia/vue-instantsearch/node_modules/instantsearch.js/node_modules/algoliasearch-helper/package.json:
    1  {
    2:   "name": "algoliasearch-helper",
    3    "version": "2.26.1",
    4    "description": "Helper for implementing advanced search features with algolia",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems that yarn did not correctly deduplicated the dependencies in the lockfile, I will fix this.

@Haroenv
Copy link
Contributor

Haroenv commented Jan 21, 2020

Just updating the lockfile isn't enough, we also need to update InstantSearch, since we can't be sure people will update the lockfile (and thus have duplicates)

@yannickcr
Copy link
Contributor Author

If I'm not mistaken instantsearch.js has algoliasearch-helper@^2.26.0 as dependency which already covers the new 2.28.1 so the helper gets correctly deduplicated between vue-instantsearch and instantsearch.js.

@yannickcr yannickcr requested a review from Haroenv January 22, 2020 16:22
@yannickcr yannickcr merged commit 571b1fc into master Jan 22, 2020
@yannickcr yannickcr deleted the feat/client-v4 branch January 22, 2020 17:00
Haroenv pushed a commit to algolia/instantsearch that referenced this pull request Dec 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants