Skip to content

Conversation

sgeleon
Copy link
Contributor

@sgeleon sgeleon commented Oct 3, 2024

Hi.

I have seen your solution for when the configuration doesn't loading.

I think it’s not good because we can get other bugs if we use this module in other modules because we don’t have any guarantee that we will get object not null, for example:

require('Algolia_AlgoliaSearch/js/recommend.js',

function(recommend) {

    // recommend -> this is object or null ???

})

I think you should add some checker for it.

define([
    'jquery',
    'algoliaBundle',
    'recommend',
    'recommendJs',
    'recommendProductsHtml',
    'domReady!'
],function ($, algoliaBundle, recommend, recommendJs, recommendProductsHtml) {
    'use strict';

    return function (config, element) {

        function checkerConfigLoading() {
            if (typeof algoliaConfig === 'undefined')
                setTimeout(checkerConfigLoading, '500')
            else
                exec()
        }

        function exec() {

           ....

      }
});

@sgeleon sgeleon changed the base branch from main to release/3.14.0-beta October 3, 2024 10:07
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.

1 participant