Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

items can be null in getWidgetRenderState #5229

Closed

Conversation

Yonn-Trimoreau
Copy link

I've installed your latest Magento module and found that in certain situations (which I could not clearly identify), this variable items can be null, causing an exception when trying to filter on a sub category.

When checking the nullity of this variable as I've done in the PR, the issue is fixed.

Here is a screenshot of the JS error when trying to filter "Lave-linge" at this url https://www.gacd.fr/amenagement/cuisine-electromenager/gros-electromenager.html

(I will fix this issue by patching in some way so the error won't be visible for long)

image

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 107af9e:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-hooks-default-theme Configuration

@Haroenv
Copy link
Contributor

Haroenv commented Dec 21, 2022

I believe the magento plugin may be outdated in its InstantSearch version, did you isolate this issue already? It would be interesting to see in which case items can be null.

Thanks for your PR!

I guess if transformItems returns null, items could be undefined, but wouldn't you already have other problems as well if items isn't at least an empty array?

https://github.com/algolia/instantsearch.js/blob/3f98ab69cb5cfafb1fb1c7c6930e9bf542621f44/packages/instantsearch.js/src/connectors/menu/connectMenu.ts#L303-L309

@Yonn-Trimoreau
Copy link
Author

I have the latest Magento 2 module installed (3.9.1), and the only file I have access to in this module is the "algoliaBundle.min.js" which is, you guessed it, minified, so debugging is quite hard, and I don't know how to find the non minified algoliaBundle.js to proceed debugging.

I only know that the file mentions a version 4.5.0 as a header, and I found this bit of code by searching in the whole Algolia's GitHub organisation by text (took me some time already).

And I've manually changed this bit in my local version of the minified file and this works (I clearly don't know how and why).

@Haroenv
Copy link
Contributor

Haroenv commented Dec 22, 2022

I'm trying to reproduce the bug, you mentioned that you patched it on the website, but I don't see the error and it still looks like the code from before the patch is applied:

Screenshot 2022-12-22 at 10 03 45

Thanks!

@Haroenv
Copy link
Contributor

Haroenv commented Dec 30, 2022

Thanks again for your PR. Because we can't reproduce this, and I don't see how it can happen (transformItems return null maybe? but then it shouldn't work anyway because of other reasons) I'll close this PR. Feel free to open again with a test or continue with the patch on your website.

Thanks!

@Haroenv Haroenv closed this Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants