avitorio/outstatic

Deleting a collection breaks vercel deployment

Closed this issue · 2 comments

Hey, there! Nice project!

I was just trying this out. I started from the blog example and tried deleting the "projects" collection from the admin panel. That caused the vercel deployment to fail.

The reason for this is that the src/pages/projects/[slug].tsx file still exists. Plus, the src/pages/index.tsx also has a variable allProjects that reads the projects from the file.

Since this is a CMS, I would expect that deleting wouldn't break that, right? Or am I doing something wrong?

If it's just something that needs to be handled in the future, I'd look to hear how you plan to solve that. Maybe I can help a bit 😄

Hey @bernardobelchior

You're right. That shouldn't happen.

I'll fix it during the week.

If you want to give it a try, you can fork the repo and run:

pnpm install

pnpm dev --filter=outstatic-dev-blog --filter=outstatic

I don't know if the problem is with the library or just the example blog, but I am on mobile and can't really check.

Perhaps fetching an inexistent collection throws an error in the library, so maybe wrap that call in a try catch and return an empty array if that's the case...

If you find a solution, go ahead and create a PR. I'll review it when I can.

Thanks for letting me know about this issue! 👍🏼

I just added a fix for this. If an inexistent collection is fetched we now return an empty array. Thanks for flagging.