-
Notifications
You must be signed in to change notification settings - Fork 171
MAGE-974 InstantSearch extension points #1709
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
Conversation
damcou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonderful work ! 🥳 💪
I really like how the file looks now, this is a lot easier to understand, even for a non-js developer ;) .
Added a few comments but nothing blocking for you to go forward.
Out of curiosity, have you considered splitting the file into multiple ones since this is still a 1000+ lines one ? This isn't mandatory for sure, I guess this has its own pros.
|
Thanks for the feedback! I'll pick up these observations on the next PR. 👍
I did consider this! What's holding me back is that I would like to make these components available as UMD modules at some point for applications outside of Luma / RequireJS (like Hyvä etc.). Having too many dependencies can make that cumbersome unless we implement a build process for that (and we just ditched the build process necessary for For now, I'm keeping the monolithic approach but just adding a bit of structure and scoping because before it was extremely brittle. Happy to revisit this in the future - but hopefully this is a step in the right direction. |
Summary
This PR aims to clean up the monolithic JS implementation with its heavy use of broadly scoped variables and closures and scattered implementation. We historically have had hooks to help customize the way the JavaScript works but it's very limited. Now it will be possible to write a mixin on any function to avoid overwriting the entire JS file.
beforeFacetInitializationhas been added which allows a user to extend the functionality by adding, removing or modifying "builder" functions which are used to define a facet config that will drive the rendering of facetsResult
Unit tests need to be added for this large revamp but manual testing has been performed including (but not limited to):