fix(infinite/hits): stop saving the transformed results in cache #4907
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Since we introduced getWidgetRenderState, transformItems gets called two times. On its own this isn't problematic, however if the transformItems "mutates" a key, it will receive next the "mutated" hits instead of the ones that come from the results
One thing which is debatable about this PR is which parts should be saved to
results.hits
. I opted for just the escaped hits, but i wonder if there's any use cases for considering the query id and position as part of the hits directly.However, I feel like if we want this behaviour, it shouldn't be hits and infiniteHits mutating results, but rather something global that gets called right after the results get returned. In fact, I also think it makes more sense to escape hits there than in hits.
I don't think removing the escapeHTML option is possible here without breaking change though, so if we want to do that, we should mark it as a possibility for a major in this PR
Result
hits
that come directly computed from a result, not from a previous transformItemsFX-11
fixes #4819