Skip to content

Commit

Permalink
feat: expose raw request content under _rawContent (#6544)
Browse files Browse the repository at this point in the history
* feat: expose raw request content under _rawContent

* fix: bundlesize

* fix: clone object + only add _rawContent when it contains data

* chore: handle rawContent at other places

* chore: revert index widget changes
  • Loading branch information
e-krebs authored Jan 24, 2025
1 parent e598230 commit 5883502
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bundlesize.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"path": "packages/react-instantsearch/dist/umd/ReactInstantSearch.min.js",
"maxSize": "65.55 kB"
"maxSize": "65.75 kB"
},
{
"path": "packages/vue-instantsearch/vue2/umd/index.js",
Expand Down
7 changes: 7 additions & 0 deletions packages/algoliasearch-helper/src/algoliasearch.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -1844,6 +1844,11 @@ AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (
if (this._currentNbQueries === 0) this.emit('searchQueueEmpty');

var results = content.results.slice();
var rawContent = Object.create(content);
delete rawContent.results;
if (Object.keys(rawContent).length <= 0) {
rawContent = undefined;
}

states.forEach(function (s) {
var state = s.state;
Expand All @@ -1864,10 +1869,12 @@ AlgoliaSearchHelper.prototype._dispatchAlgoliaResponse = function (
specificResults,
self._searchResultsOptions
);
helper.lastResults._rawContent = rawContent;

helper.emit('result', {
results: helper.lastResults,
state: state,
_rawContent: rawContent,
});
});
};
Expand Down

0 comments on commit 5883502

Please sign in to comment.