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

Rework of InstantSearch extensionality [BC break] #822

Merged
merged 1 commit into from
May 5, 2017

Conversation

JanPetr
Copy link
Contributor

@JanPetr JanPetr commented May 4, 2017

Implements #821

@JanPetr JanPetr requested a review from bobylito May 4, 2017 15:08
@JanPetr JanPetr changed the title Rework of InstantSearch extensionality Rework of InstantSearch extensionality [BC break] May 4, 2017
@JanPetr JanPetr force-pushed the feat/reworked_IS_extensionality branch from 76b47f5 to 9f9e200 Compare May 4, 2017 15:20
Copy link
Contributor

@bobylito bobylito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks very good! I think you should provide some tooling to be able to fetch a specific widget config based on some predicate (attribute name or kind of widget) because otherwise it could be tedious to update.

Feel free to discard my comments if they don't fit with your coding style.

allWidgetConfiguration = algoliaHookBeforeWidgetInitialization(allWidgetConfiguration);
}

for (var widgetType in allWidgetConfiguration) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reuse $.each here too.


for (var widgetType in allWidgetConfiguration) {
if (Array.isArray(allWidgetConfiguration[widgetType]) === true) {
for (var i = 0; i < allWidgetConfiguration[widgetType].length; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd reuse $.each here too.

addWidget(search, widgetType, widgetConfig);
}

continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd replace that with an else statement two lines after.

var widgetType = widgetInfo[0],
widgetConfig = widgetInfo[1];

if (typeof allWidgetConfiguration[widgetType] === 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd go for:

if (typeof allWidgetConfiguration[widgetType] === 'undefined') {
  allWidgetConfiguration[widgetType] = [widgetConfig];
} else { 			
  allWidgetConfiguration[widgetType].push(widgetConfig);
}

@JanPetr JanPetr force-pushed the feat/reworked_IS_extensionality branch from 9f9e200 to 388de6a Compare May 5, 2017 08:22
@JanPetr JanPetr merged commit 820678f into develop May 5, 2017
@JanPetr JanPetr deleted the feat/reworked_IS_extensionality branch May 5, 2017 09:17
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.

2 participants