poteto / ember-hypersearch

Hyperspeed real-time search with caching
MIT License
55 stars 24 forks source link

Queries can include periods without breaking the cache #20

Closed mattmcmanus closed 8 years ago

mattmcmanus commented 8 years ago

If you're using a hypersearch component to search for things that contain periods, like email addresses, as soon as you type the period things break. Since it's using the query itself as the key, Embers get/set gets all sorts of crankypants This commit replaces periods in queries as dashes.

I duplicated some of the tests to account for this scenario. It feels a bit ham-fisted, but I was hesitant to refactor the keyForQuery method to make it easily testable on its own.

Let me know if you have thoughts about how to do this better.

poteto commented 8 years ago

Thanks for this PR, good catch!

mattmcmanus commented 8 years ago

Hey @poteto! I pulled out the one change into a separate method. It feels a bit verbose, but it's clear. I also pinned jquery so that the tests would run.

Artistan commented 8 years ago

implemented in fork/rename to hypersearcher... https://www.npmjs.com/package/ember-hypersearcher

poteto commented 8 years ago

@homu r+

homu commented 8 years ago

:pushpin: Commit bdf5b01 has been approved by poteto

homu commented 8 years ago

:zap: Test exempted - status