mathieudutour / gatsby-digital-garden

🌷 🌻 🌺 Create a digital garden with Gatsby
https://mathieudutour.github.io/gatsby-digital-garden
MIT License
665 stars 103 forks source link

Search broken due to flexsearch dependency issues #136

Closed Ameobea closed 3 years ago

Ameobea commented 3 years ago

I noticed that the search on my own site using this template has stopped working due to JS errors coming from FlexSearch in use-search.js. It seems that the top-level FlexSearch.create() does not exist. The example site is also broken with the same issue: https://mathieudutour.github.io/gatsby-digital-garden/

From what I can tell, gatsby-plugin-local-search uses "flexsearch": "0.6.4" and gatsby-theme-garden uses "flexsearch": "0.7.2". I'm not 100% sure that this is the source of the issue and I don't know why it's not importing the two different versions properly, but in any case the line in use-search.js that does FlexSearch.create() is failing because FlexSearch.create is undefined.

Ameobea commented 3 years ago

It seems that this commit caused the break: https://github.com/mathieudutour/gatsby-digital-garden/commit/d00159bff296a5109a3e97c50005f48a2206aab4

That makes sense since it bumped flexsearch from 0.6.3 to 0.7.2.

Reverting gatsby-theme-garden to =0.1.58 seems to have fixed search for me. I tried to test locally by cloning this repo, changing the version, and requiring, but the build fails because of this bug: https://github.com/gatsbyjs/gatsby/issues/20718

mathieudutour commented 3 years ago

Ah yeah sorry, I downgraded flexsearch again, it seems the new version isn't ready yet