Skip to content

perf(compare): render once per selection change - #7302

Draft
Haroenv wants to merge 1 commit into
masterfrom
perf/compare-single-render
Draft

Haroenv wants to merge 1 commit into
masterfrom
perf/compare-single-render

Conversation

@Haroenv

@Haroenv Haroenv commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Changing the compare selection rendered every compare widget twice: once from the store listeners and once from the scheduleRender() that followed. notify still schedules the full render, which re-renders the compare widgets together with anything reading renderState.compare (for example a hits template button) and emits the instance render event. Each listener now renders directly only when the full render would skip its widget, that is while its parent index has no results yet. In that case it also refreshes renderState[indexId].compare.

Result

Each compare widget renders once per selection change: from the scheduled render once results exist, synchronously from the listener before the first results. Non-compare widgets reading renderState.compare still re-render. Tests count renderFn calls per toggleItem with two widgets on a real InstantSearch instance, and cover a plain widget reading the compare render state.

🤖 Generated with Claude Code

@codacy-production

codacy-production Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 16 complexity

Metric Results
Complexity 16

View in Codacy

TIP This summary will be updated as you push new changes.

@pkg-pr-new

pkg-pr-new Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
More templates

algoliasearch-helper

npm i https://pkg.pr.new/algolia/instantsearch/algoliasearch-helper@7302

instantsearch-ui-components

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch-ui-components@7302

instantsearch.css

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.css@7302

instantsearch.js

npm i https://pkg.pr.new/algolia/instantsearch/instantsearch.js@7302

react-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch@7302

react-instantsearch-core

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-core@7302

react-instantsearch-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-nextjs@7302

react-instantsearch-router-nextjs

npm i https://pkg.pr.new/algolia/instantsearch/react-instantsearch-router-nextjs@7302

vue-instantsearch

npm i https://pkg.pr.new/algolia/instantsearch/vue-instantsearch@7302

commit: 2a3d9e0

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Size Change: +384 B (+0.04%)

Total Size: 1.04 MB

📦 View Changed
Filename Size Change
packages/instantsearch.js/dist/instantsearch.development.js 334 kB +228 B (+0.07%)
packages/instantsearch.js/dist/instantsearch.production.min.js 152 kB +56 B (+0.04%)
packages/react-instantsearch-core/dist/umd/ReactInstantSearchCore.min.js 73.9 kB +50 B (+0.07%)
packages/react-instantsearch/dist/umd/ReactInstantSearch.min.js 125 kB +50 B (+0.04%)
ℹ️ View Unchanged
Filename Size Change
packages/algoliasearch-helper/dist/algoliasearch.helper.js 44.5 kB +1 B (0%)
packages/algoliasearch-helper/dist/algoliasearch.helper.min.js 14.1 kB +5 B (+0.04%)
packages/instantsearch.css/components/ai-mode-button.css 1.76 kB 0 B
packages/instantsearch.css/components/autocomplete-min.css 4.33 kB 0 B
packages/instantsearch.css/components/autocomplete.css 4.68 kB 0 B
packages/instantsearch.css/components/button.css 1.98 kB 0 B
packages/instantsearch.css/components/chat-min.css 7.4 kB 0 B
packages/instantsearch.css/components/chat.css 7.91 kB 0 B
packages/instantsearch.css/components/filter-suggestions.css 1.89 kB 0 B
packages/instantsearch.css/themes/algolia-min.css 11.9 kB 0 B
packages/instantsearch.css/themes/algolia.css 12.6 kB 0 B
packages/instantsearch.css/themes/nova-min.css 12 kB 0 B
packages/instantsearch.css/themes/nova.css 12.8 kB 0 B
packages/instantsearch.css/themes/reset-min.css 1.3 kB 0 B
packages/instantsearch.css/themes/reset.css 1.38 kB 0 B
packages/instantsearch.css/themes/satellite-min.css 12.8 kB 0 B
packages/instantsearch.css/themes/satellite.css 13.7 kB 0 B
packages/vue-instantsearch/vue2/cjs/index.js 19.9 kB 0 B
packages/vue-instantsearch/vue2/umd/index.js 74.3 kB -4 B (-0.01%)
packages/vue-instantsearch/vue3/cjs/index.js 20.6 kB 0 B
packages/vue-instantsearch/vue3/umd/index.js 74.7 kB -6 B (-0.01%)

compressed-size-action

@Haroenv
Haroenv force-pushed the perf/compare-single-render branch from 529d301 to 2a3d9e0 Compare October 16, 2026 15:21

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant