Skip to content
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

WIP next major #6382

Draft
wants to merge 37 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
600d612
fix(templating): remove hogan.js (#6378)
aymeric-giraudet Oct 8, 2024
ae64a27
fix(widgets): remove analytics widget (#6398)
Haroenv Oct 18, 2024
6318218
fix(widgets): remove places widget (#6397)
Haroenv Oct 18, 2024
a0aee99
fix(widgets): remove answers widget (#6399)
Haroenv Oct 18, 2024
86b6558
fix(instantsearch): remove EXPERIMENTAL_use (#6401)
Haroenv Oct 18, 2024
d056fbe
fix(methods): remove deprecated helper methods (#6402)
Haroenv Oct 21, 2024
b4ec677
fix(widgets): remove experimental widgets (#6400)
Haroenv Oct 23, 2024
90aa7d7
chore(codemods): remove codemods from instantsearch.js package (#6396)
Haroenv Oct 23, 2024
6fe1fcb
fix(helpers): remove deprecated helpers (#6403)
Haroenv Oct 24, 2024
6bbfc5a
refactor: introduce `instantsearch-core` (#6371)
sarahdayan Oct 25, 2024
448a00e
feat(tests): remove ie11 targeting tests (#6415)
dhayab Oct 29, 2024
f9e9d39
feat(babel): upgrade and set newer browser targets (#6422)
aymeric-giraudet Nov 5, 2024
6d6e593
refactor: remove obsolete polyfills (#6417)
dhayab Dec 5, 2024
56f6b5e
refactor: remove insightsClient prop (#6462)
Haroenv Dec 6, 2024
07ed6a9
fix(searchForFacetValues): only call client.search (#6465)
Haroenv Dec 9, 2024
9aa59d8
fix(insights): remove bindEvent (#6471)
Haroenv Dec 12, 2024
ddaea7b
fix(geoSearch): hasMapMovedSinceLastRefine (#6470)
Haroenv Dec 12, 2024
57d5209
fix(error): directly emit error from events (#6472)
Haroenv Dec 12, 2024
ddaeebb
fix(core): remove searchMetadata (#6474)
Haroenv Dec 18, 2024
ee3f7ef
feat(index): remove getWidgetState (#6476)
Haroenv Dec 18, 2024
d344104
feat(routing): replace getLocation with getCurrentURL (#6477)
Haroenv Dec 20, 2024
28658d3
feat(helper): persistHierarchicalRootCount: true (#6478)
Haroenv Dec 20, 2024
ff4d655
fix(vue): don't spread in ais-state-results (#6481)
Haroenv Dec 21, 2024
8001aec
fix(connectors): replace hits for items (#6486)
Haroenv Dec 26, 2024
22de6f5
fix(state): change behaviour of preserveSharedStateOnUnmount (#6488)
Haroenv Dec 26, 2024
72aad49
fix(connectors): don't expose duplicates of canRefine (#6484)
Haroenv Dec 30, 2024
9afa5cc
fix(refinementList): canRefine is calculated for searchable (#6494)
Haroenv Dec 30, 2024
4d93df6
fix(instantsearch): remove addWidget, removeWidget methods (#6498)
Haroenv Dec 31, 2024
f435184
feat(routing): change default of cleanUrlOnDispose to false (#6499)
Haroenv Dec 31, 2024
9f2f442
ci: run e2e tests on next branch (#6500)
dhayab Dec 31, 2024
84cd027
fix(instantsearch): remove searchFunction (#6502)
Haroenv Dec 31, 2024
d27e36a
fix(build): prevent destructure with reuse of same symbol. (#6504)
Haroenv Dec 31, 2024
4c69f0b
refactor(range): make range connector more consistent and simpler to …
dhayab Jan 7, 2025
1c6e293
feat(connectors): cleanup life cycle without dispose (#6497)
Haroenv Jan 8, 2025
1ad44f1
chore: remove no longer needed comments (#6517)
Haroenv Jan 8, 2025
0531b36
refactor(instantsearch): replace "helper" with the value of "mainHelp…
Haroenv Jan 9, 2025
bafb0cb
refactor(routing): simplify historyRouter and tests (#6503)
Haroenv Jan 13, 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 @@ -67,6 +67,7 @@ workflows:
branches:
only:
- master
- next
- helper docs:
requires:
- build
Expand All @@ -80,11 +81,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 @@ -93,6 +95,7 @@ workflows:
branches:
only:
- master
- next
- release if needed:
context: fx-libraries
requires:
Expand Down Expand Up @@ -137,7 +140,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 @@ -178,6 +181,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
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
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
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
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
4 changes: 2 additions & 2 deletions examples/js/media/src/widgets/Articles.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { formatDistanceToNow } from 'date-fns';
import { html, render } from 'htm/preact';
import { Hit } from 'instantsearch.js';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import { connectInfiniteHits } from 'instantsearch.js/es/connectors';
import { Snippet, Highlight } from 'instantsearch.js/es/helpers/components';

type Result = Hit<{
type Result = AlgoliaHit<{
slug: string;
primary_category: {
slug: string;
Expand Down
2 changes: 1 addition & 1 deletion examples/js/tourism/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/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/react/default-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"algoliasearch": "5.1.1",
"instantsearch.css": "8.5.1",
"instantsearch.js": "4.77.3",
"instantsearch-core": "0.1.0",
"react": "19.0.0",
"react-dom": "19.0.0",
"react-instantsearch": "7.15.3"
Expand Down
2 changes: 1 addition & 1 deletion examples/react/default-theme/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { liteClient as algoliasearch } from 'algoliasearch/lite';
import { Hit as AlgoliaHit } from 'instantsearch.js';
import { Hit as AlgoliaHit } from 'instantsearch-core';
import React from 'react';
import {
InstantSearch,
Expand Down
4 changes: 2 additions & 2 deletions examples/react/default-theme/src/components/NumericMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export type NumericMenuProps = React.ComponentProps<'div'> &
UseNumericMenuProps;

export function NumericMenu(props: NumericMenuProps) {
const { hasNoResults, items, refine } = useNumericMenu(props);
const { canRefine, items, refine } = useNumericMenu(props);

return (
<div
className={cx(
'ais-NumericMenu',
hasNoResults && 'ais-NumericMenu--noRefinement',
!canRefine && 'ais-NumericMenu--noRefinement',
props.className
)}
>
Expand Down
Loading