Was created with unknown prop ::Warnings::

I am ready to deploy my website, but I get an error in the logs. I noticed that I have a lot of warnings in my console :


The thing is, that this is one of the starter projects that comes with prismic for sveltkit.

I did this to see if the new projects have the same issues as my main project and it does. How can we avoid these warnings ? I feel like it does not help in deploying my website since in my case, I get the following errors when deploying my main website :

Hi @janisgaudreault.jg ,

It's your new-to-svelte friend again.
I took a peek over at their preview of that svelte project and then inspected the console. I do see a bunch of warnings but they're all related to the third party cookies. Maybe inspecting the code for this repo might help see if they did some Harry Potter magic to prevent these warnings:

Home (sveltekit-starter-prismic-multi-page.vercel.app)

prismicio-community/sveltekit-starter-prismic-multi-page: SvelteKit and Prismic multi-page starter (github.com)

Hey Friend! Thanks for the suggestion, I will check this out! :slight_smile:

@janisgaudreault.jg Hey sorry I missed this thread earlier in the week.

This is a known and common issue with Svelte. The yellow warnings in your console are only dev warnings, and they shouldn't appear in production.

The issue is the SliceZone component passes a bunch of props to every slice component (like the index of the slice in the slice zone and arbitrary context). These are sometimes useful, but most of the time you don't need them. Since you're not using them, Svelte creates a warning because it thinks you might have made a mistake. But everything is working fine! If you really want to suppress the warnings, you can declare the props:

<script>
  export let slice, index, context
</script>

That should silence them, but it will add some clutter to your code.

(Based on the warnings, I assume you're also passing custom components to PrismicRichText — which works the same way.)

For the Cannot read properties of undefined error, is it still happening? That looks like it could be a data fetching error.

SAm

Hey Sam, thanks for the reply. I'll keep your advice in mind. It's reassuring to know that these warnings don't occur in production deployments. Maintaining a clean console, free of warnings and errors, aligns with best practices for applications and websites.

To address deployment issues, I've implemented conditional statements throughout my code to check for data presence before templating. This approach has effectively resolved the issues.

For instance, if I forget to associate an author with an article, but my template expects an author, it would previously generate errors. However, now the data is only displayed if it's available, mitigating these issues.

Another improvement I made for deployment was ensuring there are no unused imports in my code. By addressing these issues, my deployment finally succeeded! :blush: