Skip to content

WIP next major #6382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
803aa1a
fix(templating): remove hogan.js (#6378)
aymeric-giraudet Oct 8, 2024
a44d94b
fix(widgets): remove analytics widget (#6398)
Haroenv Oct 18, 2024
610b4a8
fix(widgets): remove places widget (#6397)
Haroenv Oct 18, 2024
7e7cc55
fix(widgets): remove answers widget (#6399)
Haroenv Oct 18, 2024
82c3e46
fix(instantsearch): remove EXPERIMENTAL_use (#6401)
Haroenv Oct 18, 2024
776a44f
fix(methods): remove deprecated helper methods (#6402)
Haroenv Oct 21, 2024
cc09e74
fix(widgets): remove experimental widgets (#6400)
Haroenv Oct 23, 2024
7e274d9
chore(codemods): remove codemods from instantsearch.js package (#6396)
Haroenv Oct 23, 2024
4180cec
fix(helpers): remove deprecated helpers (#6403)
Haroenv Oct 24, 2024
cc2bd43
refactor: introduce `instantsearch-core` (#6371)
sarahdayan Oct 25, 2024
bd95af0
feat(tests): remove ie11 targeting tests (#6415)
dhayab Oct 29, 2024
3dee414
feat(babel): upgrade and set newer browser targets (#6422)
aymeric-giraudet Nov 5, 2024
d33a221
refactor: remove obsolete polyfills (#6417)
dhayab Dec 5, 2024
1315e42
refactor: remove insightsClient prop (#6462)
Haroenv Dec 6, 2024
3f9200c
fix(searchForFacetValues): only call client.search (#6465)
Haroenv Dec 9, 2024
b40d5ad
fix(insights): remove bindEvent (#6471)
Haroenv Dec 12, 2024
c39807a
fix(geoSearch): hasMapMovedSinceLastRefine (#6470)
Haroenv Dec 12, 2024
8717e9a
fix(error): directly emit error from events (#6472)
Haroenv Dec 12, 2024
0923a3b
fix(core): remove searchMetadata (#6474)
Haroenv Dec 18, 2024
4fd55e2
feat(index): remove getWidgetState (#6476)
Haroenv Dec 18, 2024
01e25b4
feat(routing): replace getLocation with getCurrentURL (#6477)
Haroenv Dec 20, 2024
e00015b
feat(helper): persistHierarchicalRootCount: true (#6478)
Haroenv Dec 20, 2024
9fd36ce
fix(vue): don't spread in ais-state-results (#6481)
Haroenv Dec 21, 2024
5efea20
fix(connectors): replace hits for items (#6486)
Haroenv Dec 26, 2024
0dd37bc
fix(state): change behaviour of preserveSharedStateOnUnmount (#6488)
Haroenv Dec 26, 2024
6ed9713
fix(connectors): don't expose duplicates of canRefine (#6484)
Haroenv Dec 30, 2024
f522a19
fix(refinementList): canRefine is calculated for searchable (#6494)
Haroenv Dec 30, 2024
cf67297
fix(instantsearch): remove addWidget, removeWidget methods (#6498)
Haroenv Dec 31, 2024
3809bad
feat(routing): change default of cleanUrlOnDispose to false (#6499)
Haroenv Dec 31, 2024
03f6bc2
ci: run e2e tests on next branch (#6500)
dhayab Dec 31, 2024
56c73e5
fix(instantsearch): remove searchFunction (#6502)
Haroenv Dec 31, 2024
ebb70e4
fix(build): prevent destructure with reuse of same symbol. (#6504)
Haroenv Dec 31, 2024
dca5314
refactor(range): make range connector more consistent and simpler to …
dhayab Jan 7, 2025
21e66ee
feat(connectors): cleanup life cycle without dispose (#6497)
Haroenv Jan 8, 2025
920b6b7
chore: remove no longer needed comments (#6517)
Haroenv Jan 8, 2025
3e634fa
refactor(instantsearch): replace "helper" with the value of "mainHelp…
Haroenv Jan 9, 2025
861904f
refactor(routing): simplify historyRouter and tests (#6503)
Haroenv Jan 13, 2025
3e9df7f
feat(helper): remove searchOnce callback (#6563)
Haroenv Feb 17, 2025
32f50ac
feat(helper): remove previousPage and nextPage (#6565)
Haroenv Feb 17, 2025
2332a60
feat(helper): remove getRefinements, hasRefinements (#6570)
Haroenv Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ workflows:
branches:
only:
- master
- next
- helper docs:
requires:
- build
Expand All @@ -82,11 +83,12 @@ workflows:
- examples
matrix:
parameters:
browser: [chrome, firefox, internet explorer]
browser: [chrome, firefox]
filters:
branches:
only:
- master
- next
- e2e tests router nextjs:
context: fx-libraries
requires:
Expand All @@ -95,6 +97,7 @@ workflows:
branches:
only:
- master
- next
- release if needed:
context: fx-libraries
requires:
Expand Down Expand Up @@ -139,7 +142,7 @@ workflows:
- examples
matrix:
parameters:
browser: [chrome, firefox, internet explorer]
browser: [chrome, firefox]
- e2e tests router nextjs:
context: fx-libraries
requires:
Expand Down Expand Up @@ -180,6 +183,7 @@ jobs:
- packages/vue-instantsearch/vue2
- packages/vue-instantsearch/vue3
- packages/instantsearch-ui-components/dist
- packages/instantsearch-core/dist

test metadata:
<<: *defaults
Expand Down
3 changes: 2 additions & 1 deletion .codesandbox/ci.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"packages/react-instantsearch-nextjs",
"packages/vue-instantsearch",
"packages/instantsearch.css",
"packages/instantsearch-ui-components"
"packages/instantsearch-ui-components",
"packages/instantsearch-core"
],
"node": "20"
}
33 changes: 22 additions & 11 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const config = {
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/method-signature-style': 'error',
'@typescript-eslint/unbound-method': 'error',
'import/no-unresolved': ['error'],
},
},
{
Expand Down Expand Up @@ -214,21 +215,11 @@ const config = {
rules: {
'no-restricted-syntax': [
'error',
{
selector: '[async=true]',
message:
'The polyfill for async/await is very large, which is why we use promise chains',
},
{
selector: 'ForInStatement',
message:
'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
},
{
selector: 'ForOfStatement',
message:
'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
},
{
selector: 'LabeledStatement',
message:
Expand All @@ -242,6 +233,23 @@ const config = {
],
},
},
{
files: 'packages/**/*',
excludedFiles: [
'*.test.*',
'**/__tests__/**',
'**/stories/**',
'packages/algoliasearch-helper/documentation-src/**',
],
plugins: ['compat'],
extends: ['plugin:compat/recommended'],
env: {
browser: true,
},
settings: {
lintAllEsApis: true,
},
},
// Disable stricter rules introduced for the next versions of the libraries.
{
files: [
Expand All @@ -265,7 +273,10 @@ const config = {
},
},
{
files: ['packages/instantsearch.js/src/**/*'],
files: [
'packages/instantsearch.js/src/**/*',
'packages/instantsearch-core/src/**/*',
],
excludedFiles: [
'**/__tests__/**/*',
'packages/instantsearch.js/src/widgets/**/*',
Expand Down
51 changes: 14 additions & 37 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = (api) => {
if (isTest) {
targets.node = true;
} else {
targets.browsers = ['last 2 versions', 'ie >= 9'];
targets.browsers = require('./package.json').browserslist;
}

const testPlugins = [
Expand Down Expand Up @@ -61,42 +61,6 @@ module.exports = (api) => {
],
},
],
// this plugin is used to test if we need polyfills, not to actually insert them
// only UMD, since cjs & esm have false positives due to imports
isUMD && [
'polyfill-es-shims',
{
method: 'usage-global',
targets: {
ie: 11,
},
shouldInjectPolyfill(name, defaultShouldInject) {
const exclude = [
// false positives (we access these from objects only)
'Array.prototype.item',
'String.prototype.item',
'Array.prototype.values',
'Function.prototype.name',

// we require polyfills for this already
'Array.prototype.includes',

// false positive (babel doesn't know types)
// this is actually only called on arrays
'String.prototype.includes',

// false positive (spread)
'Object.getOwnPropertyDescriptors',
];
if (defaultShouldInject && !exclude.includes(name)) {
throw new Error(
`Usage of a builtin which isn't allowed to be polyfilled: ${name}`
);
}
return false;
},
},
],
]);

return {
Expand Down Expand Up @@ -142,6 +106,19 @@ module.exports = (api) => {
],
],
},
{
test: 'packages/instantsearch-core',
plugins: [
[
'@babel/plugin-transform-runtime',
{
corejs: false,
helpers: true,
regenerator: false,
},
],
],
},
],
// jsx is transpiled, so the comment should no longer be present in the final files
shouldPrintComment: (value) => !value.startsWith('* @jsx'),
Expand Down
2 changes: 1 addition & 1 deletion examples/js/algolia-experiences/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"instantsearch.css": "8.5.1"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/core": "2.10.0",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/js/calendar-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"instantsearch.js": "4.77.3"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
"parcel": "2.10.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce-umd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"instantsearch.js": "4.77.3"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/core": "2.10.0",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce-umd/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Polyfill service v3.111.0
* For detailed credits and licence information see https://polyfill.io.
* For detailed credits and license information see https://polyfill.io.
*
* Features requested: Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,Object.assign,Object.entries,Promise,default
*
Expand Down
8 changes: 8 additions & 0 deletions examples/js/e-commerce-umd/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ import { attachEventListeners } from './ui';

search.start();
attachEventListeners();

declare global {
interface Window {
search: typeof search;
}
}

window.search = search;
15 changes: 8 additions & 7 deletions examples/js/e-commerce-umd/src/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function getCategoryName(slug: string): string {
const originalWindowTitle = document.title;

const router = window.instantsearch.routers.history<RouteState>({
cleanUrlOnDispose: false,
windowTitle({ category, query }) {
const queryTitle = query ? `Results for "${query}"` : '';

Expand All @@ -89,10 +88,10 @@ const router = window.instantsearch.routers.history<RouteState>({
.join(' | ');
},

createURL({ qsModule, routeState, location }): string {
const { protocol, hostname, port = '', pathname, hash } = location;
createURL({ qsModule, routeState, currentURL }): string {
const { protocol, hostname, port = '', pathname, hash } = currentURL;
const portWithPrefix = port === '' ? '' : `:${port}`;
const urlParts = location.href.match(/^(.*?)\/search/);
const urlParts = currentURL.href.match(/^(.*?)\/search/);
const baseUrl =
(urlParts && urlParts[0]) ||
`${protocol}//${hostname}${portWithPrefix}${pathname}search`;
Expand Down Expand Up @@ -156,12 +155,14 @@ const router = window.instantsearch.routers.history<RouteState>({
return `${baseUrl}/${categoryPath}${queryString}${hash}`;
},

parseURL({ qsModule, location }): RouteState {
const pathnameMatches = location.pathname.match(/search\/(.*?)\/?$/);
parseURL({ qsModule, currentURL }): RouteState {
const pathnameMatches = currentURL.pathname.match(/search\/(.*?)\/?$/);
const category = getCategoryName(
(pathnameMatches && pathnameMatches[1]) || ''
);
const queryParameters = qsModule.parse(location.search.slice(1));
const queryParameters = qsModule.parse(currentURL.search, {
ignoreQueryPrefix: true,
});
const {
query = '',
page = 1,
Expand Down
5 changes: 3 additions & 2 deletions examples/js/e-commerce-umd/src/widgets/Products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export const products = hits<Hit>({
</article>
`;
},
empty(results, { html }) {
const hasRefinements = results.getRefinements().length > 0;
empty(_, { html }) {
const hasRefinements =
window.search.renderState.instant_search.clearRefinements?.canRefine;
const description = hasRefinements
? 'Try to reset your applied filters.'
: 'Please try another query.';
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"instantsearch.js": "4.77.3"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/core": "2.10.0",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/js/e-commerce/polyfills.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Polyfill service v3.111.0
* For detailed credits and licence information see https://polyfill.io.
* For detailed credits and license information see https://polyfill.io.
*
* Features requested: Array.prototype.find,Array.prototype.findIndex,Array.prototype.includes,Object.assign,Object.entries,Promise,default
*
Expand Down
8 changes: 8 additions & 0 deletions examples/js/e-commerce/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@ import 'instantsearch.css/themes/reset.css';

search.start();
attachEventListeners();

declare global {
interface Window {
search: typeof search;
}
}

window.search = search;
15 changes: 8 additions & 7 deletions examples/js/e-commerce/src/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function getCategoryName(slug: string): string {
const originalWindowTitle = document.title;

const router = historyRouter<RouteState>({
cleanUrlOnDispose: false,
windowTitle({ category, query }) {
const queryTitle = query ? `Results for "${query}"` : '';

Expand All @@ -91,10 +90,10 @@ const router = historyRouter<RouteState>({
.join(' | ');
},

createURL({ qsModule, routeState, location }): string {
const { protocol, hostname, port = '', pathname, hash } = location;
createURL({ qsModule, routeState, currentURL }): string {
const { protocol, hostname, port = '', pathname, hash } = currentURL;
const portWithPrefix = port === '' ? '' : `:${port}`;
const urlParts = location.href.match(/^(.*?)\/search/);
const urlParts = currentURL.href.match(/^(.*?)\/search/);
const baseUrl =
(urlParts && urlParts[0]) ||
`${protocol}//${hostname}${portWithPrefix}${pathname}search`;
Expand Down Expand Up @@ -158,12 +157,14 @@ const router = historyRouter<RouteState>({
return `${baseUrl}/${categoryPath}${queryString}${hash}`;
},

parseURL({ qsModule, location }): RouteState {
const pathnameMatches = location.pathname.match(/search\/(.*?)\/?$/);
parseURL({ qsModule, currentURL }): RouteState {
const pathnameMatches = currentURL.pathname.match(/search\/(.*?)\/?$/);
const category = getCategoryName(
(pathnameMatches && pathnameMatches[1]) || ''
);
const queryParameters = qsModule.parse(location.search.slice(1));
const queryParameters = qsModule.parse(currentURL.search, {
ignoreQueryPrefix: true,
});
const {
query = '',
page = 1,
Expand Down
5 changes: 3 additions & 2 deletions examples/js/e-commerce/src/widgets/Products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ export const products = hits<Hit>({
</article>
`;
},
empty(results, { html }) {
const hasRefinements = results.getRefinements().length > 0;
empty(_, { html }) {
const hasRefinements =
window.search.renderState.instant_search.clearRefinements?.canRefine;
const description = hasRefinements
? 'Try to reset your applied filters.'
: 'Please try another query.';
Expand Down
2 changes: 1 addition & 1 deletion examples/js/getting-started/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"instantsearch.js": "4.77.3"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/core": "2.10.0",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/js/media/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"instantsearch.js": "4.77.3"
},
"devDependencies": {
"@babel/core": "7.15.5",
"@babel/core": "7.25.9",
"@parcel/core": "2.10.0",
"@parcel/packager-raw-url": "2.10.0",
"@parcel/transformer-webmanifest": "2.10.0",
Expand Down
Loading