algolia / instantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.
https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
MIT License
3.73k stars 525 forks source link

Fix storybook examples #6368

Open gaetansenn opened 1 month ago

gaetansenn commented 1 month ago

🐛 Current behavior

This current ais-pagination example fail to open https://instantsearchjs.netlify.app/stories/vue/?path=/story/ais-pagination--

The error

algoliasearch_lite__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function
TypeError: algoliasearch_lite__WEBPACK_IMPORTED_MODULE_1___default(...) is not a function
    at previewWrapper (https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:354932)
    at Module.<anonymous> (https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:562829)
    at 942 (https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:566183)
    at __webpack_require__ (https://instantsearchjs.netlify.app/stories/vue/runtime~main.48e6b0d8faa6bd9cd3d9.bundle.js:1:1301)
    at webpackContext (https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:561759)
    at https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:499063
    at Array.forEach (<anonymous>)
    at loadStories (https://instantsearchjs.netlify.app/stories/vue/main.48e6b0d8faa6bd9cd3d9.bundle.js:2:499028)
    at https://instantsearchjs.netlify.app/stories/vue/vendors~main.48e6b0d8faa6bd9cd3d9.bundle.js:2:1727128
    at render (https://instantsearchjs.netlify.app/stories/vue/vendors~main.48e6b0d8faa6bd9cd3d9.bundle.js:2:1706722)

🔍 Steps to reproduce

Link: https://instantsearchjs.netlify.app/stories/vue/?path=/story/ais-pagination--

Live reproduction

https://instantsearchjs.netlify.app/stories/vue/?path=/story/ais-pagination--*

💭 Expected behavior

The example works

Package version

latest

Operating system

No response

Browser

No response

Code of Conduct

Haroenv commented 1 month ago

Not sure what caused it (probably webpack/babel config since moving to v5 of algoliasearch). The js examples still seem to work, so you can use those instead for now: https://instantsearchjs.netlify.app/stories/js/?path=/story/pagination-pagination--default

We were thinking of possibly removing the storybooks as they don't bring much value and are decent amount of work. What are you using the storybooks for. Just to see an example of what the widget renders like or something else as well?

gaetansenn commented 1 month ago

Hi @Haroenv,

Thank you for your reply. I agree with you on the usage of Storybook. I just wanted to report the bug, that's all. :)

gaetansenn commented 1 month ago

I dont really know how to report a bug in your documentation but the liteClient is imported like this :

import { liteClient } from 'algoliasearch/lite'

and not

import { liteClient } from 'algoliasearch'

https://www.algolia.com/doc/libraries/javascript/v5/methods/search/

Haroenv commented 1 month ago

The first way is the correct way @gaetansenn, if you import from "non-lite" it's import { algoliasearch } from 'algoliasearch'

gaetansenn commented 1 month ago

Yes, I know. Just point out the errors in the doc:

Screenshot 2024-09-24 at 13 59 49

Haroenv commented 1 month ago

Ah I see I misread your comment, fixing :)