-
Notifications
You must be signed in to change notification settings - Fork 529
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
Conversation
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:
|
There was a problem hiding this 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?
packages/create-instantsearch-app/e2e/__snapshots__/templates.test.js.snap
Outdated
Show resolved
Hide resolved
packages/instantsearch.js/src/widgets/range-slider/range-slider.tsx
Outdated
Show resolved
Hide resolved
packages/instantsearch.js/src/widgets/range-input/range-input.tsx
Outdated
Show resolved
Hide resolved
@@ -96,7 +98,6 @@ export type RangeWidgetDescription = { | |||
}; | |||
indexUiState: { | |||
range: { | |||
// @TODO: this could possibly become `${number}:${number}` later |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
This reverts commit ec478bf.
- currentRefinement values are clamped to range - currentRefinement values are undefined if equal to range
…use (#6508) BREAKING CHANGE: `start` is now called `currentRefinement` and its data structure and behavior are different
Summary
This PR reworks
connectRange
and its widgets to provide a simpler and more consistent experience.BREAKING CHANGE:
start
is now calledcurrentRefinement
and has the same type asrange
({ min: number, max: number }
)FX-3189