Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

fix(getFacetValues): don't throw error when there's no facet #720

Merged
merged 2 commits into from
Jul 11, 2019

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Jul 10, 2019

connectMenu could throw if a facet is retrieved which isn't in the SearchParameters, but we are changing that to return undefined in those cases.

This is part 1 of the big error removal process.

see algolia/instantsearch#3084
see #722

connectMenu could throw if a facet is retrieved which isn't in the SearchParameters, but we are changing that to return undefined in those cases.

This is part 1 of the big error removal process.
@Haroenv Haroenv requested a review from a team July 10, 2019 10:59
@ghost ghost requested review from eunjae-lee and francoischalifour and removed request for a team July 10, 2019 10:59
test/spec/SearchResults/getFacetValues.js Outdated Show resolved Hide resolved
test/spec/SearchResults/getFacetValues.js Outdated Show resolved Hide resolved
good calls, thanks @samouss

Co-Authored-By: Samuel Vaillant <samuel.vllnt@gmail.com>
@Haroenv Haroenv requested a review from samouss July 10, 2019 11:03
Haroenv added a commit to algolia/instantsearch that referenced this pull request Jul 10, 2019
If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720
Haroenv added a commit to algolia/instantsearch that referenced this pull request Jul 10, 2019
If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720
Haroenv added a commit to algolia/instantsearch that referenced this pull request Jul 10, 2019
If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720
Haroenv added a commit that referenced this pull request Jul 10, 2019
This now should also return `undefined` without warning, like #720
@Haroenv Haroenv mentioned this pull request Jul 10, 2019
Haroenv added a commit that referenced this pull request Jul 11, 2019
* fix(getFacetStats): remove error

This now should also return `undefined` without warning, like #720

* chore: fix test
@Haroenv Haroenv merged commit 1987d6d into next Jul 11, 2019
@Haroenv Haroenv deleted the fix/error-facet-values branch July 11, 2019 08:10
Haroenv added a commit to algolia/instantsearch that referenced this pull request Jul 15, 2019
If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720
Haroenv added a commit to algolia/instantsearch that referenced this pull request Jul 15, 2019
* fix(menu): prevent error on stale search

If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720

* test: add a test declaring the use case with wrong helper state
samouss pushed a commit to algolia/instantsearch that referenced this pull request Sep 17, 2019
* fix(menu): prevent error on stale search

If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720

* test: add a test declaring the use case with wrong helper state
samouss pushed a commit to algolia/instantsearch that referenced this pull request Sep 17, 2019
* fix(menu): prevent error on stale search

If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720

* test: add a test declaring the use case with wrong helper state
samouss pushed a commit to algolia/instantsearch that referenced this pull request Sep 17, 2019
* fix(menu): prevent error on stale search

If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720

* test: add a test declaring the use case with wrong helper state
Haroenv added a commit to algolia/instantsearch that referenced this pull request Oct 23, 2019
* fix(menu): prevent error on stale search

If a menu is added while the search is being stale, we will  recieve undefined (currently an error), so we can not fetch `.data` from it.

requires algolia/algoliasearch-helper-js#720

* test: add a test declaring the use case with wrong helper state
Haroenv added a commit that referenced this pull request Nov 18, 2019
* fix(getFacetStats): remove error

This now should also return `undefined` without warning, like #720

* chore: fix test
Haroenv added a commit that referenced this pull request Nov 18, 2019
* fix(getFacetValues): don't throw error when there's no facet

connectMenu could throw if a facet is retrieved which isn't in the SearchParameters, but we are changing that to return undefined in those cases.

This is part 1 of the big error removal process.

* Apply suggestions from code review

good calls, thanks @samouss

Co-Authored-By: Samuel Vaillant <samuel.vllnt@gmail.com>
Haroenv added a commit that referenced this pull request Nov 18, 2019
 *  fix(merge): change implementation  (#716) 29c2138
 * chore: mention remaining changes f756947
 * chore(deps): update circleci/node:8.15.1 docker digest to ef1a0c4 (#715) f4dab89
 * chore(lodash): remove _.omit (#655) 7db8b4c
 * chore(lodash): remove lodash from dependency list (#705) a63ec6b, closes #552
 * chore(release): allow canary release (#712) 3eb087c
 * chore(removeHierarchicalFacetRefinement): remove error if not refined (#747) e68ecfe
 * chore: merge develop into master (#750) 53c7c62
 * chore: remove Bower support (#711) e7518e2
 * chore(ts): add methods d051f79
 * chore(ts): add ruleContexts to SP 4bdc4a4
 * chore(ts): add searchOnlyWithDerivedHelpers (#739) c6aa31b
 * chore(ts): publish definition file too 1813462
 * chore(TS): isNumericRefined has only one required argument cac8fc3
 * chore(warn): remove unused function (lodash.bind) (#682) c59b7e3
 * chore: update release command 0989880
 * docs: add link to wiki 3598f2a
 * docs: update event signature (#701) bbe4634
 * docs(migration): mention changed methods (#732) f95e680
 * docs(next): add migration guide 8430137
 * docs(serverUsed): mention getRankingInfo (#706) f258c2a, closes #500
 * feat: implement dedicated reset page method (#673) 666501e
 * feat(getState): remove filter option (#707) ac52791
 * feat(getState): remove getState (#708) 7de698c
 * feat(requestBuilder): prevent needless extra requests for empty refinements (#737) db0a392
 * feat(search): allow the search only with Derived Helpers (#704) aa128fc
 * feat(SearchParameters): avoid undefined values (#703) 9757e0a
 * feat(typescript): move typings inline (#719) a12272e
 * fix(defaults): remove const 48a0c48
 * fix(errors): remove isRefined (#731) 5761885
 * fix(getConjunctiveRefinements): no error when requested facet is not conjunctive (#724) cf852e7
 * fix(getDisjunctiveRefinements): remove error (#725) 211e390
 * fix(getExcludeRefinements): replace error by default value (#726) 9d7ae87
 * fix(getFacetStats): remove error (#721) 96b6ec8
 * fix(getFacetValues): don't throw error when there's no facet (#720) e15e39e
 * fix(getHierarchicalFacetBreadcrumb): don't throw an error (#723) 40e1d61
 * fix(isDisjunctiveFacetRefined): return false if not in disjunctiveFacets (#729) 13ec09b
 * fix(isExcludeRefined): remove error in favor of false (#728) 3f0ab6b
 * fix(isFacetRefined): return false if facet isn't declared (#727) 7151f56
 * fix(isHierarchicalFacetRefined): return false if refinement isn't a facet (#730) 89fa010
 * fix(lodash/intersection): replace with custom implementation (#718) 00dfb4e
 * fix(removeXFacet): make sure this fully removes empty arrays (#743) ea5a22a
 * fix(results): remove lodash looping over objects (#648) bb025c2, closes #258
 * fix(sortBy): compare whole prefix instead of first character (#702) b85fb50, closes #702
 * fix(toggleRefinement): keep an empty array when clearing (#738) 5b3fc11
 * fix(types): add state.removeNumericRefinement (#742) e58c24a
 * refactor(addAgent): remove duplicate code (#657) d023efd
 * refactor(error): use object vs list of arguments (#700) 722eceb
 * refactor(lodash): compact (#689) 284efa5
 * refactor(lodash): forOwn (#697) eae367a
 * refactor(lodash): intersection (#696) 25822a5
 * refactor(lodash): map & trim (#679) 357fcb7
 * refactor(lodash): merge (#694) 92bced4
 * refactor(lodash): partial & partialRight (#693) 7ceea2f
 * refactor(lodash): remove filter (#685) 249d2e6
 * refactor(lodash): remove flatten (#695) 9da0e08
 * refactor(lodash): remove forEach (#674) 8c93765
 * refactor(lodash): remove reduce (#678) 7907805
 * refactor(lodash): remove simple functions (#656) c309ffa
 * refactor(lodash): remove startsWith (#690) bb00933
 * refactor(lodash): replace defaults with pure alternative (#692) ee07132
 * refactor(lodash): replace find & findIndex (#687) 92e7c23
 * refactor(lodash): replace orderBy (#698) bb2b31e
 * refactor(lodash): sumBy (#688) a538bd9
 * refactor(result): use object vs list of arguments (#699) 643f18e
 * refactor(search): emit object (#683) 46c7d7d
 * refactor(searchForFacetValues): use object vs list of arguments (#684) ab8e9c5
 * refactor: remove getQueryParameter (#713) d9dfac4
 * refactor(searchOnce): use object vs list of arguments (#681) 42b40d3
 * refactor(SearchParameters): removes default values (#670) b15696b
 * refactor(url): remove url helpers (#652) 52e22f4
 * test(sffv): no longer test impossible responses (#686) fd878e8

### BREAKING CHANGE

* getState(filters) is replaced my manually filtering the returned object
* removed helper.isRefined, use helper.hasRefinements instead
* SearchParameters.filter is removed

* doc(filter): remove reference
* use helper.state instead of helper.getState()
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
* fix(getFacetStats): remove error

This now should also return `undefined` without warning, like algolia/algoliasearch-helper-js#720

* chore: fix test
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
…/algoliasearch-helper-js#720)

* fix(getFacetValues): don't throw error when there's no facet

connectMenu could throw if a facet is retrieved which isn't in the SearchParameters, but we are changing that to return undefined in those cases.

This is part 1 of the big error removal process.

* Apply suggestions from code review

good calls, thanks @samouss

Co-Authored-By: Samuel Vaillant <samuel.vllnt@gmail.com>
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
 *  fix(merge): change implementation  (algolia/algoliasearch-helper-js#716) algolia/algoliasearch-helper-js@736c8ae
 * chore: mention remaining changes algolia/algoliasearch-helper-js@1f7ea90
 * chore(deps): update circleci/node:8.15.1 docker digest to ef1a0c4 (algolia/algoliasearch-helper-js#715) algolia/algoliasearch-helper-js@4b2c788
 * chore(lodash): remove _.omit (algolia/algoliasearch-helper-js#655) algolia/algoliasearch-helper-js@055257d
 * chore(lodash): remove lodash from dependency list (algolia/algoliasearch-helper-js#705) algolia/algoliasearch-helper-js@d1be213, closes algolia/algoliasearch-helper-js#552
 * chore(release): allow canary release (algolia/algoliasearch-helper-js#712) algolia/algoliasearch-helper-js@a72f0de
 * chore(removeHierarchicalFacetRefinement): remove error if not refined (algolia/algoliasearch-helper-js#747) algolia/algoliasearch-helper-js@89dc193
 * chore: merge develop into master (algolia/algoliasearch-helper-js#750) algolia/algoliasearch-helper-js@77e3e84
 * chore: remove Bower support (algolia/algoliasearch-helper-js#711) algolia/algoliasearch-helper-js@69d00a5
 * chore(ts): add methods algolia/algoliasearch-helper-js@3c4ee8f
 * chore(ts): add ruleContexts to SP algolia/algoliasearch-helper-js@bdb516e
 * chore(ts): add searchOnlyWithDerivedHelpers (algolia/algoliasearch-helper-js#739) algolia/algoliasearch-helper-js@1f5dd4c
 * chore(ts): publish definition file too algolia/algoliasearch-helper-js@4949596
 * chore(TS): isNumericRefined has only one required argument algolia/algoliasearch-helper-js@1d4e7fb
 * chore(warn): remove unused function (lodash.bind) (algolia/algoliasearch-helper-js#682) algolia/algoliasearch-helper-js@da805d9
 * chore: update release command algolia/algoliasearch-helper-js@3255f36
 * docs: add link to wiki algolia/algoliasearch-helper-js@f0915c3
 * docs: update event signature (algolia/algoliasearch-helper-js#701) algolia/algoliasearch-helper-js@1a0c343
 * docs(migration): mention changed methods (algolia/algoliasearch-helper-js#732) algolia/algoliasearch-helper-js@1c9bdcd
 * docs(next): add migration guide algolia/algoliasearch-helper-js@dfb08f0
 * docs(serverUsed): mention getRankingInfo (algolia/algoliasearch-helper-js#706) algolia/algoliasearch-helper-js@4a8d8f7, closes algolia/algoliasearch-helper-js#500
 * feat: implement dedicated reset page method (algolia/algoliasearch-helper-js#673) algolia/algoliasearch-helper-js@8fa4ee4
 * feat(getState): remove filter option (algolia/algoliasearch-helper-js#707) algolia/algoliasearch-helper-js@681bf17
 * feat(getState): remove getState (algolia/algoliasearch-helper-js#708) algolia/algoliasearch-helper-js@b951579
 * feat(requestBuilder): prevent needless extra requests for empty refinements (algolia/algoliasearch-helper-js#737) algolia/algoliasearch-helper-js@a03ff29
 * feat(search): allow the search only with Derived Helpers (algolia/algoliasearch-helper-js#704) algolia/algoliasearch-helper-js@3da864c
 * feat(SearchParameters): avoid undefined values (algolia/algoliasearch-helper-js#703) algolia/algoliasearch-helper-js@7812536
 * feat(typescript): move typings inline (algolia/algoliasearch-helper-js#719) algolia/algoliasearch-helper-js@68af05e
 * fix(defaults): remove const algolia/algoliasearch-helper-js@7df8754
 * fix(errors): remove isRefined (algolia/algoliasearch-helper-js#731) algolia/algoliasearch-helper-js@1da0000
 * fix(getConjunctiveRefinements): no error when requested facet is not conjunctive (algolia/algoliasearch-helper-js#724) algolia/algoliasearch-helper-js@b7c9a3f
 * fix(getDisjunctiveRefinements): remove error (algolia/algoliasearch-helper-js#725) algolia/algoliasearch-helper-js@c573d33
 * fix(getExcludeRefinements): replace error by default value (algolia/algoliasearch-helper-js#726) algolia/algoliasearch-helper-js@77f6770
 * fix(getFacetStats): remove error (algolia/algoliasearch-helper-js#721) algolia/algoliasearch-helper-js@3b593d7
 * fix(getFacetValues): don't throw error when there's no facet (algolia/algoliasearch-helper-js#720) algolia/algoliasearch-helper-js@cfdbc5b
 * fix(getHierarchicalFacetBreadcrumb): don't throw an error (algolia/algoliasearch-helper-js#723) algolia/algoliasearch-helper-js@4a75244
 * fix(isDisjunctiveFacetRefined): return false if not in disjunctiveFacets (algolia/algoliasearch-helper-js#729) algolia/algoliasearch-helper-js@7cb124d
 * fix(isExcludeRefined): remove error in favor of false (algolia/algoliasearch-helper-js#728) algolia/algoliasearch-helper-js@238e975
 * fix(isFacetRefined): return false if facet isn't declared (algolia/algoliasearch-helper-js#727) algolia/algoliasearch-helper-js@c2d8afe
 * fix(isHierarchicalFacetRefined): return false if refinement isn't a facet (algolia/algoliasearch-helper-js#730) algolia/algoliasearch-helper-js@0a913c7
 * fix(lodash/intersection): replace with custom implementation (algolia/algoliasearch-helper-js#718) algolia/algoliasearch-helper-js@dd63327
 * fix(removeXFacet): make sure this fully removes empty arrays (algolia/algoliasearch-helper-js#743) algolia/algoliasearch-helper-js@33f256c
 * fix(results): remove lodash looping over objects (algolia/algoliasearch-helper-js#648) algolia/algoliasearch-helper-js@f3287d8, closes algolia/algoliasearch-helper-js#258
 * fix(sortBy): compare whole prefix instead of first character (algolia/algoliasearch-helper-js#702) algolia/algoliasearch-helper-js@21fcd34, closes algolia/algoliasearch-helper-js#702
 * fix(toggleRefinement): keep an empty array when clearing (algolia/algoliasearch-helper-js#738) algolia/algoliasearch-helper-js@9ab228d
 * fix(types): add state.removeNumericRefinement (algolia/algoliasearch-helper-js#742) algolia/algoliasearch-helper-js@e8b4b34
 * refactor(addAgent): remove duplicate code (algolia/algoliasearch-helper-js#657) algolia/algoliasearch-helper-js@050a17f
 * refactor(error): use object vs list of arguments (algolia/algoliasearch-helper-js#700) algolia/algoliasearch-helper-js@c70d6ee
 * refactor(lodash): compact (algolia/algoliasearch-helper-js#689) algolia/algoliasearch-helper-js@7a5af0e
 * refactor(lodash): forOwn (algolia/algoliasearch-helper-js#697) algolia/algoliasearch-helper-js@a0af759
 * refactor(lodash): intersection (algolia/algoliasearch-helper-js#696) algolia/algoliasearch-helper-js@0077f50
 * refactor(lodash): map & trim (algolia/algoliasearch-helper-js#679) algolia/algoliasearch-helper-js@a8c5f2c
 * refactor(lodash): merge (algolia/algoliasearch-helper-js#694) algolia/algoliasearch-helper-js@7cb5357
 * refactor(lodash): partial & partialRight (algolia/algoliasearch-helper-js#693) algolia/algoliasearch-helper-js@151685d
 * refactor(lodash): remove filter (algolia/algoliasearch-helper-js#685) algolia/algoliasearch-helper-js@16a3aff
 * refactor(lodash): remove flatten (algolia/algoliasearch-helper-js#695) algolia/algoliasearch-helper-js@d2b667f
 * refactor(lodash): remove forEach (algolia/algoliasearch-helper-js#674) algolia/algoliasearch-helper-js@58fd08f
 * refactor(lodash): remove reduce (algolia/algoliasearch-helper-js#678) algolia/algoliasearch-helper-js@187ae67
 * refactor(lodash): remove simple functions (algolia/algoliasearch-helper-js#656) algolia/algoliasearch-helper-js@ed2a393
 * refactor(lodash): remove startsWith (algolia/algoliasearch-helper-js#690) algolia/algoliasearch-helper-js@75f1035
 * refactor(lodash): replace defaults with pure alternative (algolia/algoliasearch-helper-js#692) algolia/algoliasearch-helper-js@c5b0c89
 * refactor(lodash): replace find & findIndex (algolia/algoliasearch-helper-js#687) algolia/algoliasearch-helper-js@c190cb3
 * refactor(lodash): replace orderBy (algolia/algoliasearch-helper-js#698) algolia/algoliasearch-helper-js@7805cd8
 * refactor(lodash): sumBy (algolia/algoliasearch-helper-js#688) algolia/algoliasearch-helper-js@a037c6f
 * refactor(result): use object vs list of arguments (algolia/algoliasearch-helper-js#699) algolia/algoliasearch-helper-js@f4ea805
 * refactor(search): emit object (algolia/algoliasearch-helper-js#683) algolia/algoliasearch-helper-js@1029dcd
 * refactor(searchForFacetValues): use object vs list of arguments (algolia/algoliasearch-helper-js#684) algolia/algoliasearch-helper-js@d2acced
 * refactor: remove getQueryParameter (algolia/algoliasearch-helper-js#713) algolia/algoliasearch-helper-js@6b8c643
 * refactor(searchOnce): use object vs list of arguments (algolia/algoliasearch-helper-js#681) algolia/algoliasearch-helper-js@a86581a
 * refactor(SearchParameters): removes default values (algolia/algoliasearch-helper-js#670) algolia/algoliasearch-helper-js@2679f99
 * refactor(url): remove url helpers (algolia/algoliasearch-helper-js#652) algolia/algoliasearch-helper-js@b9e3fd9
 * test(sffv): no longer test impossible responses (algolia/algoliasearch-helper-js#686) algolia/algoliasearch-helper-js@09e475f

### BREAKING CHANGE

* getState(filters) is replaced my manually filtering the returned object
* removed helper.isRefined, use helper.hasRefinements instead
* SearchParameters.filter is removed

* doc(filter): remove reference
* use helper.state instead of helper.getState()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants