algolia / gatsby-plugin-algolia

A plugin to push to Algolia based on graphQl queries
https://yarn.pm/gatsby-plugin-algolia
Apache License 2.0
177 stars 45 forks source link

weird destructuring in onPostBuild #115

Closed logemann closed 3 years ago

logemann commented 3 years ago

the code:

exports.onPostBuild = async function ({ graphql }, config) {
  const {
    appId,
    apiKey,
    queries,
    concurrentQueries = true,
    skipIndexing = false
  } = config;

doesnt work on my gatsby installation because the parameters you are looking for are in "config.options" and not "config". But this is such a hughe bug, i somehow wonder if its just me :-)

Haroenv commented 3 years ago

Thanks for posting this issue, which version of Gatsby do you use? Have you tried the version in the example in this repo, does it make a difference? If you could make a reproducible example I'd love to take a look to what's going on.

logemann commented 3 years ago

Gatsby CLI version: 2.16.1 Gatsby version: 2.29.0

I am using the very same config as in the example i think. And i think the index builder code doesnt use the "indexName" config option from gatsby-config.js. When leaving out the indexName in the queries array, the default indexName from config should be used....

Update: Oh thats the same error reason.

function groupQueriesByIndex(queries = [], config) {
    const {indexName: mainIndexName} = config;

i guess when using config.options, this works as well.

Haroenv commented 3 years ago

I think this should be fixed by #127