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

refactor(range): make range connector more consistent and simpler to use #6508

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

dhayab
Copy link
Member

@dhayab dhayab commented Jan 2, 2025

Summary

This PR reworks connectRange and its widgets to provide a simpler and more consistent experience.

BREAKING CHANGE: start is now called currentRefinement and has the same type as range ({ min: number, max: number })

FX-3189

Copy link

codesandbox-ci bot commented Jan 2, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c5f05da:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration

@dhayab dhayab marked this pull request as ready for review January 3, 2025 16:51
@dhayab dhayab requested review from a team, sarahdayan, shaejaz and Haroenv and removed request for a team January 3, 2025 16:51
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

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

I like the changes done so far, just wonder if we could avoid the current/range/undefined dance in input?

examples/react/e-commerce/components/PriceSlider.tsx Outdated Show resolved Hide resolved
packages/vue-instantsearch/src/components/RangeInput.vue Outdated Show resolved Hide resolved
@@ -96,7 +98,6 @@ export type RangeWidgetDescription = {
};
indexUiState: {
range: {
// @TODO: this could possibly become `${number}:${number}` later
Copy link
Contributor

Choose a reason for hiding this comment

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

changing it required casting in too many places?

Copy link
Member Author

Choose a reason for hiding this comment

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

The uiState for range is already ${min}:${max}, so I discarded the todo.

Copy link
Contributor

Choose a reason for hiding this comment

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

yes but typed as string though? not much benefit so I'm ok with leaving it as is

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah this was meant as a template literal type! I didn't get it. Tried it and there is a type inconsistency somewhere. I'll look into it.

dhayab and others added 4 commits January 6, 2025 14:37
@dhayab dhayab requested a review from Haroenv January 7, 2025 09:57
@dhayab dhayab merged commit c2614bd into next Jan 7, 2025
10 checks passed
@dhayab dhayab deleted the refactor/simplify-range branch January 7, 2025 10:47
Haroenv pushed a commit that referenced this pull request Jan 9, 2025
…use (#6508)

BREAKING CHANGE: `start` is now called `currentRefinement` and its data structure and behavior are different
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.

2 participants