Skip to content

Commit

Permalink
Merge pull request #15 from apisearch-io/fix/updated-version-and-fixe…
Browse files Browse the repository at this point in the history
…d-parts

Fixed apisearch version and fixed parts
  • Loading branch information
mmoreram authored Jul 15, 2018
2 parents 3b2f02b + ad3a9e5 commit 15ee137
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 31 deletions.
30 changes: 20 additions & 10 deletions dist/apisearch-ui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/apisearch-ui.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/apisearch-ui.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/apisearch-ui.min.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apisearch-ui",
"version": "0.2.2",
"version": "0.2.3",
"description": "Javascript User Interface of Apisearch.",
"main": "./dist/apisearch-ui.js",
"scripts": {
Expand Down Expand Up @@ -44,7 +44,7 @@
"webpack-merge": "^4.1.3"
},
"dependencies": {
"apisearch": "^0.2.6",
"apisearch": "^0.2.8",
"clone-deep": "^4.0.0",
"flux": "^3.1.3",
"hogan.js": "^3.0.2",
Expand Down
5 changes: 4 additions & 1 deletion src/components/ClearFilters/ClearFiltersActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export function clearFiltersAction(
) {
const clonedQuery = cloneDeep(currentQuery);

clonedQuery.filters = [];
clonedQuery.filters = {
_query: currentQuery.getFilter("_query"),
};

clonedQuery.page = 1;
const dispatcher = container.get(`${APISEARCH_DISPATCHER}__${environmentId}`);

Expand Down
5 changes: 2 additions & 3 deletions src/components/ClearFilters/ClearFiltersComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ class ClearFiltersComponent extends Component<ClearFiltersProps, ClearFiltersSta
* @param props
*/
componentWillReceiveProps(props) {
let filters = props.currentQuery.filters;
let filters = props.currentQuery.getFilters();
let areFiltersActive = (
Object.keys(filters).length !== 0 &&
filters.length !== 0
Object.keys(filters).length > 1
);

this.setState({showClearFilters: areFiltersActive});
Expand Down
8 changes: 4 additions & 4 deletions src/components/Result/ResultActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ export function changeItemsPerResultPageSetup(
/**
* Promoted uuids
*/
if (promotedUUIDs.length !== 0) {
clonedQuery.promoteUUIDs(promotedUUIDs);
for (const i in promotedUUIDs) {
clonedQuery.promoteUUID(promotedUUIDs[i]);
}

/**
* excluded uuids
*/
if (excludedUUIDs.length !== 0) {
clonedQuery.excludeUUIDs(excludedUUIDs);
for (const i in excludedUUIDs) {
clonedQuery.excludeUUID(excludedUUIDs[i]);
}

const dispatcher = container.get(`${APISEARCH_DISPATCHER}__${environmentId}`);
Expand Down
13 changes: 11 additions & 2 deletions src/components/Result/ResultComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Template from "../Template";
import {defaultItemsListTemplate} from "./defaultTemplates";
import {changeItemsPerResultPageSetup} from "./ResultActions";
import {ResultProps} from "./ResultProps";
import {ItemUUID} from "apisearch/lib/Model/ItemUUID";

/**
* Result Component
Expand All @@ -24,8 +25,16 @@ class ResultComponent extends Component<ResultProps> {
props.currentQuery,
props.itemsPerPage,
props.highlightsEnabled,
props.promote,
props.exclude
props.promote.map((itemUUID) => {
return itemUUID instanceof ItemUUID
? itemUUID
: ItemUUID.createFromArray(itemUUID)
}),
props.exclude.map((itemUUID) => {
return itemUUID instanceof ItemUUID
? itemUUID
: ItemUUID.createFromArray(itemUUID)
})
);
}

Expand Down

0 comments on commit 15ee137

Please sign in to comment.