Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
Feedback from review
Browse files Browse the repository at this point in the history
Co-Authored-By: samouss <samouss@users.noreply.github.com>
  • Loading branch information
Haroenv and samouss committed Apr 15, 2019
1 parent 2915186 commit 9cdd2da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,6 @@ describe('connectGeoSearch', () => {

const actual = connector.getProvidedProps(
props,
{},
searchState,
searchResults
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,12 @@ export default createConnector({
displayName: 'AlgoliaGeoSearch',

getProvidedProps(props, searchState, searchResults) {
const results = getResults(searchResults, {
const context = {
ais: props.contextValue,
multiIndexContext: props.indexContextValue,
});
};

const results = getResults(searchResults, context);

// We read it from both because the SearchParameters & the searchState are not always
// in sync. When we set the refinement the searchState is used but when we clear the refinement
Expand All @@ -145,7 +147,7 @@ export default createConnector({
const currentRefinementFromSearchState = getCurrentRefinement(
props,
searchState,
{ ais: props.contextValue, multiIndexContext: props.indexContextValue }
context
);

const currentRefinementFromSearchParameters =
Expand All @@ -157,7 +159,7 @@ export default createConnector({
const currentPositionFromSearchState = getCurrentPosition(
props,
searchState,
{ ais: props.contextValue, multiIndexContext: props.indexContextValue }
context
);

const currentPositionFromSearchParameters =
Expand Down Expand Up @@ -214,24 +216,18 @@ export default createConnector({
getMetadata(props, searchState) {
const items = [];
const id = getBoundingBoxId();
const index = getIndexId({
const context = {
ais: props.contextValue,
multiIndexContext: props.indexContextValue,
});
};
const index = getIndexId(context);
const nextRefinement = {};
const currentRefinement = getCurrentRefinement(props, searchState, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue,
});
const currentRefinement = getCurrentRefinement(props, searchState, context);

if (currentRefinement) {
items.push({
label: `${id}: ${currentRefinementToString(currentRefinement)}`,
value: nextState =>
refine(nextState, nextRefinement, {
ais: props.contextValue,
multiIndexContext: props.indexContextValue,
}),
value: nextState => refine(nextState, nextRefinement, context),
currentRefinement,
});
}
Expand Down

0 comments on commit 9cdd2da

Please sign in to comment.