docsearch icon indicating copy to clipboard operation
docsearch copied to clipboard

Recent Searches is always empty

Open jackmcdade opened this issue 2 years ago • 5 comments

Description

We're using the latest @docsearch/js alpha and the the Recent Searches never update. I spent a few months in your Discord trying to get answers but still haven't figured out why. No one seems to have a clue, and the site is really quite simple.

Steps to reproduce

  1. Go to https://statamic.dev
  2. Search for anything
  3. Search as many more times as you want and you'll never see anything in the Recent Searches modal.

Expected behavior

Like other sites using the same version (TailwindCSS.com for example), I'd expect to see that list update.

Environment

jackmcdade avatar Dec 17 '21 13:12 jackmcdade

Hey @jackmcdade, sorry but I don't really know Laravel, so I have a few noob questions.

  • Would it be possible that there's a limitation between those two environments that does not allow us to use the localStorage?
  • Do you have any other use of the localStorage?
    • If not, could you please try using it to see if it's related to DocSearch
    • If yes, could you please define a simple use of the localStorage in the transformItems function for example

shortcuts avatar Dec 17 '21 13:12 shortcuts

Laravel is all server-side PHP and just renders HTML, nothing there would interfere with client-side JS.

We have one little helper plugin that lets us set and remove a key from localStorage, but even after removing it, the Recent Searches is still empty.

jackmcdade avatar Dec 17 '21 14:12 jackmcdade

So you are able to use localStorage from something else than DocSearch right?

Our usage is really basic, but it's also possible that it comes from that check we do. Could you try to comment it and see if it works?

shortcuts avatar Dec 17 '21 14:12 shortcuts

Yes, no issues working with localStorage. I commented out that block and still, nada. 🤔

jackmcdade avatar Dec 17 '21 15:12 jackmcdade

Any chance you can look at this in the next month or so? Been trying to figure this one out off-and-on since September.

jackmcdade avatar Jan 28 '22 16:01 jackmcdade