payload icon indicating copy to clipboard operation
payload copied to clipboard

fix(searchPlugin): ensure search updates are unique to collection

Open lynndylanhurley opened this issue 9 months ago • 1 comments

Description

Our app is using the searchPlugin with two different collections. We were having issues with search results disappearing randomly when we saved certain records.

After digging in, we found that the syncWithSearch hook is only searching for matching search records by id, not relationTo.

This resulted in the syncWithSearch hook incorrectly overwriting records in the wrong collection if they share the same ID. This patch resolves the issue.

  • [x] I have read and understand the CONTRIBUTING.md document in this repository.

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] Existing test suite passes locally with my changes

lynndylanhurley avatar May 15 '24 01:05 lynndylanhurley

I did run the test suite locally but it seems to be failing for other unrelated reasons

lynndylanhurley avatar May 15 '24 18:05 lynndylanhurley

@lynndylanhurley I think your fix makes sense. I don't think the failing tests are related.

JarrodMFlesch avatar Jul 29 '24 15:07 JarrodMFlesch