-
Notifications
You must be signed in to change notification settings - Fork 530
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
chore(getConfiguration): burn it to the ground 🔥 #4083
Conversation
@@ -62,15 +62,20 @@ See documentation: https://www.algolia.com/doc/api-reference/widgets/range-slide | |||
}); | |||
|
|||
describe('min option', () => { | |||
it('refines when no previous configuration', () => { | |||
// @TODO: gWSP does not yet take min & max in account | |||
it.skip('refines when no previous configuration', () => { |
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.
these need to be fixed in a separate PR, cc @samouss
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.
// can not use setQueryParameters || removeNumericRefinements, because | ||
// they both keep the old value. This isn't immutable, but it is fine | ||
// since it's already a copy. | ||
stateWithoutDisjunctive.numericRefinements = { |
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'm not sure if we can find a better solution for this
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.
IIRC you can use removeNumericRefinements
with the attribute only, it will perform a clear under the hood.
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.
It doesn’t actually remove the refinement, I havent found a solution which doesn’t break for refining to an empty state
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 went through the changes didn't read everything carefully but it looks good overall.
getWidgetState?( | ||
uiState: IndexUiState, | ||
widgetStateOptions: WidgetStateOptions | ||
): IndexUiState; | ||
/** | ||
* This function is required for a widget to behave correctly when a URL 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.
This is half true since we know use this function to sets the configuration too.
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.
Do you have a better description? “Also used to keep track (or merge) of refinements when other widgets are added/removed”?
src/connectors/hierarchical-menu/__tests__/connectHierarchicalMenu-test.js
Outdated
Show resolved
Hide resolved
// can not use setQueryParameters || removeNumericRefinements, because | ||
// they both keep the old value. This isn't immutable, but it is fine | ||
// since it's already a copy. | ||
stateWithoutDisjunctive.numericRefinements = { |
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.
IIRC you can use removeNumericRefinements
with the attribute only, it will perform a clear under the hood.
34516f7
to
18b7730
Compare
], | ||
}) | ||
); | ||
it('does not remove refinement', () => { |
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.
not sure I get this part.
Removing the widget should remove the refinement, no?
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.
no, a breadcrumb's refinement is set by a configure or hierarchical facet, and should thus stay. This didn't change in this PR by the way, it was simply not tested
).toEqual( | ||
new SearchParameters({ | ||
hitsPerPage: 20, | ||
hitsPerPage: 10, |
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.
isn't this supposed to be 20?
this doesn't look like it overrides it, right?
Or is it the undefined value that overrides the 20, so we end up fallbacking to the default 10 ?
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.
we override the previously set hPP with the "default" one, this was defined by #4069
Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com>
* fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min
7e0ae3d
to
7466f90
Compare
* chore: remove enhanceConfiguration * chore: remove getConfiguration from types * chore: remove getConfiguration from widgets * test(autocomplete): replace getConfiguration tests * chore: remove enhanceConfiguration test * test(refinementlist): replace getConfiguration tests * test(pagination): replace getConfiguration test * test(searchbox): replace getConfiguration tests * test(configure): replace getConfiguration in tests * test(ratingMenu): update usage of getConfiguration * test(breadcrumb): move getConfiguration tests * test(hitsPerPage): migrate getConfiguration tests * test(infinitehits): remove duplicate getConfiguration tests * test(stats): remove useless (common) test * chore: update comment * test(toggleRefinement): swap getConfiguration usages * test(refinementlist): migrate getConfiguration tests * test(clear): remove useless assertion * test(current): remove useless assertion * test(menu): update calls * test(pagination): !fixup * test(hierarchical-menu): remove redundant tests * test(sortBy): remove redundant tests * test(hits): remove redundant tests * test: remove redundant tests * test(range): update getConfiguration tests (with caveats) * !fixup linting * chore(test): remove commented code * chore: fix message Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com> * fix(range): apply min/max to getWidgetSearchParameters (#4088) * fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min * test(hpp): cleaner test without snapshots
* chore: remove enhanceConfiguration * chore: remove getConfiguration from types * chore: remove getConfiguration from widgets * test(autocomplete): replace getConfiguration tests * chore: remove enhanceConfiguration test * test(refinementlist): replace getConfiguration tests * test(pagination): replace getConfiguration test * test(searchbox): replace getConfiguration tests * test(configure): replace getConfiguration in tests * test(ratingMenu): update usage of getConfiguration * test(breadcrumb): move getConfiguration tests * test(hitsPerPage): migrate getConfiguration tests * test(infinitehits): remove duplicate getConfiguration tests * test(stats): remove useless (common) test * chore: update comment * test(toggleRefinement): swap getConfiguration usages * test(refinementlist): migrate getConfiguration tests * test(clear): remove useless assertion * test(current): remove useless assertion * test(menu): update calls * test(pagination): !fixup * test(hierarchical-menu): remove redundant tests * test(sortBy): remove redundant tests * test(hits): remove redundant tests * test: remove redundant tests * test(range): update getConfiguration tests (with caveats) * !fixup linting * chore(test): remove commented code * chore: fix message Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com> * fix(range): apply min/max to getWidgetSearchParameters (#4088) * fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min * test(hpp): cleaner test without snapshots
* chore: remove enhanceConfiguration * chore: remove getConfiguration from types * chore: remove getConfiguration from widgets * test(autocomplete): replace getConfiguration tests * chore: remove enhanceConfiguration test * test(refinementlist): replace getConfiguration tests * test(pagination): replace getConfiguration test * test(searchbox): replace getConfiguration tests * test(configure): replace getConfiguration in tests * test(ratingMenu): update usage of getConfiguration * test(breadcrumb): move getConfiguration tests * test(hitsPerPage): migrate getConfiguration tests * test(infinitehits): remove duplicate getConfiguration tests * test(stats): remove useless (common) test * chore: update comment * test(toggleRefinement): swap getConfiguration usages * test(refinementlist): migrate getConfiguration tests * test(clear): remove useless assertion * test(current): remove useless assertion * test(menu): update calls * test(pagination): !fixup * test(hierarchical-menu): remove redundant tests * test(sortBy): remove redundant tests * test(hits): remove redundant tests * test: remove redundant tests * test(range): update getConfiguration tests (with caveats) * !fixup linting * chore(test): remove commented code * chore: fix message Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com> * fix(range): apply min/max to getWidgetSearchParameters (#4088) * fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min * test(hpp): cleaner test without snapshots
* chore: remove enhanceConfiguration * chore: remove getConfiguration from types * chore: remove getConfiguration from widgets * test(autocomplete): replace getConfiguration tests * chore: remove enhanceConfiguration test * test(refinementlist): replace getConfiguration tests * test(pagination): replace getConfiguration test * test(searchbox): replace getConfiguration tests * test(configure): replace getConfiguration in tests * test(ratingMenu): update usage of getConfiguration * test(breadcrumb): move getConfiguration tests * test(hitsPerPage): migrate getConfiguration tests * test(infinitehits): remove duplicate getConfiguration tests * test(stats): remove useless (common) test * chore: update comment * test(toggleRefinement): swap getConfiguration usages * test(refinementlist): migrate getConfiguration tests * test(clear): remove useless assertion * test(current): remove useless assertion * test(menu): update calls * test(pagination): !fixup * test(hierarchical-menu): remove redundant tests * test(sortBy): remove redundant tests * test(hits): remove redundant tests * test: remove redundant tests * test(range): update getConfiguration tests (with caveats) * !fixup linting * chore(test): remove commented code * chore: fix message Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com> * fix(range): apply min/max to getWidgetSearchParameters (#4088) * fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min * test(hpp): cleaner test without snapshots
* chore: remove enhanceConfiguration * chore: remove getConfiguration from types * chore: remove getConfiguration from widgets * test(autocomplete): replace getConfiguration tests * chore: remove enhanceConfiguration test * test(refinementlist): replace getConfiguration tests * test(pagination): replace getConfiguration test * test(searchbox): replace getConfiguration tests * test(configure): replace getConfiguration in tests * test(ratingMenu): update usage of getConfiguration * test(breadcrumb): move getConfiguration tests * test(hitsPerPage): migrate getConfiguration tests * test(infinitehits): remove duplicate getConfiguration tests * test(stats): remove useless (common) test * chore: update comment * test(toggleRefinement): swap getConfiguration usages * test(refinementlist): migrate getConfiguration tests * test(clear): remove useless assertion * test(current): remove useless assertion * test(menu): update calls * test(pagination): !fixup * test(hierarchical-menu): remove redundant tests * test(sortBy): remove redundant tests * test(hits): remove redundant tests * test: remove redundant tests * test(range): update getConfiguration tests (with caveats) * !fixup linting * chore(test): remove commented code * chore: fix message Co-Authored-By: Yannick Croissant <yannick.croissant@gmail.com> * fix(range): apply min/max to getWidgetSearchParameters (#4088) * fix(connectRange): apply min/max * fix(connectRange): throw an error when max is lower than min * test(hpp): cleaner test without snapshots
getConfiguration
in every widgetgetConfiguration
from types & expectationsgetConfiguration
togetWidgetSearchParameters