diegolamanno / gatsby-source-greenhouse

Gatsby source plugin for loading job openings from greenhouse.io ⚛️
MIT License
11 stars 16 forks source link

Only the first page gets loaded #10

Open gustavscirulis opened 5 years ago

gustavscirulis commented 5 years ago

By default the Harvest API defaults to 100 job listings per page: https://developers.greenhouse.io/harvest.html#get-list-job-posts

If you have more than 100 job listings gatsby-source-greenhouse doesn't fetch them all.

I tried to fix it by updating my config options in gatsby-config.js to:

{
   resolve: `gatsby-source-greenhouse`,
   options: {
      apiToken: `{token}`,
      jobPosts: {
         live: true,
         per_page: 300
      }
   },
},

But that doesn't seem to work. It looks like they might be getting ignored since even if I change them to live: false I still get the same jobs fetched.

If I manually overwrite the defaultPluginOptions in gatsby-source-greenhouse/gatsby-node.js the right number gets fetched:

const defaultPluginOptions = {
   jobPosts: {
      live: true,
      per_page: 500
   }
};

So, I think there's two problems:

  1. The jobPosts config option gets ignored
  2. Only the first page of jobs gets fetched
diegolamanno commented 5 years ago

Hey @gustavscirulis just dropping here to let you know I already saw your issue. Going to take a look at this weekend. Thanks for your contribution!