Sending undefined in initIndex() function is creates and index with "undefined" name
While initialising the index - means calling initIndex() if no argument is sent then it considers index name as "undefined" and sends the request to algolia platform with index name value defined as undefined. Of course, the index of that name wouldn't exist in most of the systems, hence it creates a new index with the name undefined.
This is leading to two problems
- if the variable containing the index name is not having a value due to some bug, it's not possible to detect because initIndex() function is not throwing an error
- Unnecessarily, an index is created in the Algolia dashboard with an unwanted name, making it again very hard to detect or debug an issue
IMO initIndex() behaviour should be to raise an exception in case the value of the index name passed as an argument is undefined, null or an empty string
We faced the same issue. We had a bug in our system that we lost the name of the index and sent data to the undefined index. It definitely should throw an error.